Help language development. Donate to The Perl Foundation

MongoDB cpan:MARTIMM last updated on 2020-07-19

doc/Design/client-server-int1.txt
@startuml

title Client Server interaction
hide footbox

actor application as app
participant Client
participant "Client T0" as Clt0 #a0fefe
participant "Client T1" as Clt1 #fea0fe
participant Server              #a0fefe
participant "Server T" as Srvt0 #a0fea0
participant Monitor             #a0fefe
participant "Monitor T" as Mnt0 #c0c0c0
database mongod
activate mongod

app -> Client: new(uri)
activate Client

'Todo list is a structure guarded by semaphores
Client -> Client: store server\nport in todo list

Client -> Clt0: Promise.start()
activate Clt0

Clt0 -> Clt0: load server:port\nfrom todo list

Client -> app: Client object
deactivate Client

Clt0 -> Server: new()
activate Server
Server -> Monitor: new()
activate Monitor
Monitor -> Server: Monitor object
deactivate Monitor
Server -> Clt0: Server object
deactivate Server


Clt0 -> Server: server-init()
activate Server
Server -> Monitor: start-monitor()
activate Monitor
Monitor -> Mnt0: Promise.start()
activate Mnt0
Monitor -> Server: Promise
deactivate Monitor

Mnt0 -[#a000bf]-> mongod: ismaster command
mongod -[#a000bf]-> Mnt0: ismaster result
Server -> Srvt0: tap from monitor
activate Srvt0
deactivate Server

Mnt0 o-[#a000bf]->o Srvt0: monitor data
'activate Srvt0
Srvt0 -> Srvt0: Set status
'deactivate Srvt0


Clt0 -> Clt1: tap from monitor
activate Clt1
Mnt0 o-[#a000bf]->o Clt1: monitor data
deactivate Clt0

Clt1 -> Clt1: store new server\ndata in todo list

Clt1 -> Clt1: Store in\nserver list

'note right: in thread
'note right: returns immediate
'Server --> mongod: connect



app -> Client: select-server()
activate Client
Client -> Client: Get server\nfrom server\nlist
Client -> app: Server object
deactivate Client

legend
Monitor data is sent from Monitor thread using a Supply
Data in Client structures for communication are guarded with Semaphores
end legend

@enduml