class
Memo::ArcanaListener
- Memo::ArcanaListener
- Reference
- Object
Overview
Serves ArcanaService's API on an Arcana::Client.
Requests run concurrently, up to max_concurrency at a time. The client calls on_message from its WebSocket read loop, so handling a request there would hold up every other request, and the replies that memo's own bus calls (the bus/* embedding formats) are waiting for.
Up to max_waiting more requests wait for a turn. Beyond that, memo answers "busy" at once instead of queueing without limit; the read loop can't simply block for backpressure, since memo's own bus calls need it.
Included Modules
Defined in:
arcana/listener.crConstant Summary
-
ADDRESS =
"memo:rag"
Constructors
Class Method Summary
-
.already_running?(host : String, port : Int32, timeout : Time::Span = 3.seconds) : Bool
Is a memo-arcana already serving ADDRESS on the bus at host:port? Another one mustn't join: it would share the address's mailbox, and when either connection closed, the bus would drop the address for both.
Instance Method Summary
-
#handle(envelope : Arcana::Envelope) : Nil
Answer one request envelope.
-
#listen : Nil
Answer requests arriving on the client
-
#save_periodically(interval : Time::Span) : Nil
Every
interval, save the indexes of open namespaces that are due.
Instance methods inherited from module Memo::BusLog
log(msg : String)
log,
redact_db_url(text : String) : String
redact_db_url,
sensitive?(key : String) : Bool
sensitive?,
summarize(data : JSON::Any) : String
summarize,
truncate(s : String, max : Int32 = 50) : String
truncate
Class methods inherited from module Memo::BusLog
output : IO
output,
output=(output : IO)
output=
Constructor Detail
Class Method Detail
Is a memo-arcana already serving ADDRESS on the bus at host:port? Another one mustn't join: it would share the address's mailbox, and when either connection closed, the bus would drop the address for both. The bus keeps a joined service's listing across its own restarts, so a listed address is asked for help, and only a reply counts. Two instances starting at the same moment can both pass.
Instance Method Detail
Every interval, save the indexes of open namespaces that are due.
Memo saves on its own after writes; this catches changes that have
gone unsaved too long without further writes.