@startuml

participant memmgr as ":b10-memmgr"
[-> memmgr: reload\n(zonename)
activate memmgr

participant list as ":Configurable\nClientList"
memmgr -> list: getCachedZoneWriter\n(zone_name)
activate list

participant CacheConfig as ":CacheConfig"

participant zt_segment as ":ZoneTable\nSegment\n(Mapped)"
participant segment as "existing:Memory\nSegment\n(Mapped)"
participant segment2 as "new:Memory\nSegment\n(Mapped)"

list -> zt_segment: isWritable()
activate zt_segment
zt_segment --> list: true
deactivate zt_segment

list -> CacheConfig: getLoadAction()
activate CacheConfig

participant ZoneTable as ":ZoneTable"
participant ZoneWriter as "zw:ZoneWriter"

participant LoadAction as "la:LoadAction"
create LoadAction
CacheConfig -> LoadAction: <<construct>>
CacheConfig --> list: la
deactivate CacheConfig

create ZoneWriter
list -> ZoneWriter: <<construct>> (la)
list --> memmgr: zw
deactivate list

memmgr -> ZoneWriter: load()
activate ZoneWriter
ZoneWriter -> LoadAction: (funcall)
activate LoadAction

participant ZoneData as "zd_existing\n:ZoneData"
participant ZoneData2 as "zd_new\n:ZoneData"

create ZoneData2
LoadAction -> ZoneData2: <<construct>> via helpers

LoadAction --> ZoneWriter: zd_new
deactivate LoadAction
deactivate ZoneWriter

memmgr -> ZoneWriter: install()
activate ZoneWriter

ZoneWriter -> ZoneTable: addZone(zd_new)
activate ZoneTable
ZoneTable --> ZoneWriter: zd_existing (old data)
deactivate ZoneTable

deactivate ZoneWriter

memmgr -> ZoneWriter: cleanup()
activate ZoneWriter

ZoneWriter -> ZoneData: <<destroy>>
destroy ZoneData
deactivate ZoneWriter

[<- memmgr: command to\nmodules\n(datasrc_name,\nsegmentparam)
[--> memmgr: ack from all\nmodules

memmgr -> list: resetMemorySegment\n(datasrc_name,\nREAD_WRITE,\nsegmentparam)
activate list

list -> zt_segment: reset\n(READ_WRITE,\nsegmentparam)
activate zt_segment

zt_segment -> segment: <<destroy>>
destroy segment
create segment2
zt_segment -> segment2: <<construct>>

deactivate zt_segment
deactivate list

note left of memmgr: (repeat the\nsame sequence\nfor loading to the\nother segment)

memmgr -> list: getCachedZoneWriter\n(zone_name)

...

@enduml
