{{- $self := . -}}
{{- $fullname := include "orientdb.fullname" . -}}
<?xml version="1.0" encoding="UTF-8"?>
<!-- ~ Copyright (c) 2008-2012, Hazel Bilisim Ltd. All Rights Reserved. ~
  ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may
  not use this file except in compliance with the License. ~ You may obtain
  a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~
  ~ Unless required by applicable law or agreed to in writing, software ~ distributed
  under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES
  OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for
  the specific language governing permissions and ~ limitations under the License. -->

<hazelcast
        xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.3.xsd"
        xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <group>
        <name>{{ .Values.hazelcast.groupName }}</name>
        <password>{{ .Values.hazelcast.groupPassword }}</password>
    </group>
    <properties>
        <property name="hazelcast.phone.home.enabled">false</property>
        <property name="hazelcast.mancenter.enabled">false</property>
        <property name="hazelcast.memcache.enabled">false</property>
        <property name="hazelcast.rest.enabled">false</property>
        <property name="hazelcast.wait.seconds.before.join">5</property>
        <property name="hazelcast.operation.thread.count">1</property>
        <property name="hazelcast.io.thread.count">1</property>
        <property name="hazelcast.operation.generic.thread.count">1</property>
        <property name="hazelcast.client.event.thread.count">1</property>
        <property name="hazelcast.event.thread.count">1</property>
        <property name="hazelcast.heartbeat.interval.seconds">5</property>
        <property name="hazelcast.max.no.heartbeat.seconds">30</property>
        <property name="hazelcast.merge.next.run.delay.seconds">15</property>
    </properties>
    <network>
        <port auto-increment="true">2434</port>
        <join>
            <multicast enabled="false">
                <multicast-group>235.1.1.1</multicast-group>
                <multicast-port>2434</multicast-port>
            </multicast>
            <!-- TODO: Use K8s hazelcast plugin: https://github.com/orientechnologies/orientdb-docker  -->
            <tcp-ip enabled="true">
                {{- range $i, $e := until ( .Values.replicaCount | int ) }}
                <member>{{ $fullname }}-{{$i}}.{{ $fullname }}-headless.{{ $self.Release.Namespace }}.svc.cluster.local</member>
                {{- end }}
            </tcp-ip>
        </join>
    </network>
    <executor-service>
        <pool-size>16</pool-size>
    </executor-service>
</hazelcast>