@startuml

participant auth as ":b10-auth"
[-> auth: new/initial config\n(datasrc cfg)
activate auth

participant list as ":Configurable\nClientList"
create list
auth -> list: <<construct>>

auth -> list: configure(cfg)
activate list

participant cache_config as ":CacheConfig"
create cache_config
list -> cache_config: <<construct>> (cfg)

participant zt_segment as ":ZoneTable\nSegment\n(Local)"
create zt_segment
list -> zt_segment: <<construct>>
activate zt_segment

participant zone_table as ":ZoneTable"
create zone_table
zt_segment -> zone_table: <<construct>>

deactivate zt_segment

list -> zt_segment: isWritable()
activate zt_segment
note over zt_segment: Local segments are\nalways writable
zt_segment --> list: true
deactivate zt_segment

loop for each zone in cache_config
list -> cache_config: getLoadAction()
activate cache_config

participant la1 as "la1:LoadAction"
create la1
cache_config -> la1: <<construct>>

participant la2 as "la2:LoadAction"

cache_config --> list : la1

deactivate cache_config

participant w1 as "w1:ZoneWriter"
create w1
list -> w1: <<construct>> (la1)

participant w2 as "w2:ZoneWriter"

list -> w1: load()
activate w1
w1 -> la1: (funcall)
activate la1

participant zd1 as "zd1:ZoneData"
create zd1
la1 -> zd1: <<construct>> via helpers

participant zd2 as "zd2:ZoneData"

la1 --> w1: zd1
deactivate la1
deactivate w1

list -> w1: install()
activate w1

w1 -> zone_table: addZone(zd1)
activate zone_table
zone_table --> w1: NULL (no old data)
deactivate zone_table

deactivate w1

end

deactivate list
deactivate auth

...

[-> auth: reload\n(zonename)
activate auth

auth -> list: getCachedw1\n(zone_name)
activate list

list -> cache_config: getLoadAction()
activate cache_config

create la2
cache_config -> la2: <<construct>>

cache_config --> list : la2

deactivate cache_config

create w2
list -> w2: <<construct>> (la2)

list --> auth: w2

deactivate list


auth -> w2: load()
activate w2
w2 -> la2: (funcall)
activate la2

create zd2
la2 -> zd2: <<construct>> via helpers

la2 --> w2: zd2
deactivate la2
deactivate w2

auth -> w2: install()
activate w2

w2 -> zone_table: addZone(zd2)
activate zone_table
zone_table --> w2: zd1 (old data)
deactivate zone_table

deactivate w2

auth -> w2: cleanup()
activate w2

w2 -> zd1: <<destroy>>
destroy zd1
deactivate w2

deactivate auth

@enduml
