Class: ZZQ::Persistence::Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/zzq/persistence/interface.rb

Overview

Abstract base for persistence backends.

Concrete backends (Memory, PStore, future Redis/SQLite) implement the methods below. Broker state calls through this interface; the in-memory runtime state in Routing::Broker is the source of truth during a session, and the backend is the durable record that survives restarts.

v1 scope: retained messages only. Session persistence will land alongside session-expiry (M8’s deferred piece).

Direct Known Subclasses

Memory, PStore

Instance Method Summary collapse

Instance Method Details

#clear_retainedObject

Wipe all retained state. Mostly for tests and operator tooling.

Raises:

  • (NotImplementedError)


38
39
40
# File 'lib/zzq/persistence/interface.rb', line 38

def clear_retained
  raise NotImplementedError
end

#delete_retained(_topic) ⇒ Object

Remove the retained message for topic (zero-length-payload rule, MQTT-3.3.1-6).

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/zzq/persistence/interface.rb', line 32

def delete_retained(_topic)
  raise NotImplementedError
end

#load_retainedObject

Yields each persisted Message (retained). Called once at broker start to warm the in-memory RetainedStore.

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/zzq/persistence/interface.rb', line 18

def load_retained
  raise NotImplementedError
end

#save_retained(_message) ⇒ Object

Persist a retained message under message.topic. Replaces any existing retained message for that topic.

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/zzq/persistence/interface.rb', line 25

def save_retained(_message)
  raise NotImplementedError
end