store

package
v0.1.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMessageIDConflict  = errors.New("message id belongs to another origin")
	ErrDuplicateMessage   = errors.New("message already exists")
	ErrDMTopologyConflict = errors.New("direct conversation topology conflict")
	ErrRoomExists         = errors.New("room already exists")
	ErrRoomNotFound       = errors.New("room not found")
	ErrInvalidCursor      = errors.New("invalid cursor")
	ErrAgentCredential    = errors.New("agent credential mismatch")
)

Functions

func WithAttachmentRegistrationTime added in v0.1.19

func WithAttachmentRegistrationTime(ctx context.Context, at time.Time) context.Context

WithAttachmentRegistrationTime carries the already validated registration timestamp into cursor initialization. Reading the clock again after the claim commits could exhaust its range and prevent the issued token reaching READY. Only the service supplies this value; it is never taken from a wire request.

func WithPairingDeliveryLimits added in v0.1.21

func WithPairingDeliveryLimits(ctx context.Context, limits map[string]PairingDeliveryLimits) context.Context

Types

type AppendLifecycle

type AppendLifecycle struct {
	PairingDeliveriesDropped map[string]int
	Thread                   *protocol.Thread
	DM                       *protocol.DirectConversation
}

type AttachmentDeliveryStore added in v0.1.18

type AttachmentDeliveryStore interface {
	AppendMessageEventWithLifecycleContext(context.Context, protocol.Message, protocol.Event) (AppendLifecycle, error)
	PrepareAttachmentDeliveryContext(context.Context, string) ([]protocol.Event, error)
	AcknowledgeAttachmentDeliveryContext(context.Context, string, string) error
}

AttachmentDeliveryStore makes message delivery resumable independently of the in-memory event broker. Preparing an agent with no cursor establishes a baseline at the current durable head; only later unacknowledged events replay.

type ContextAgentRegistryStore

type ContextAgentRegistryStore interface {
	RegisterAgentContext(ctx context.Context, registration protocol.AgentRegistration) (RegistrationResult, error)
	ReconcileRegisteredAgentContext(ctx context.Context, registration protocol.AgentRegistration) (protocol.AgentRegistration, error)
	ListRegisteredAgentsContext(ctx context.Context) ([]protocol.AgentRegistration, error)
	GetRegisteredAgentContext(ctx context.Context, agentID string) (protocol.AgentRegistration, bool, error)
	GetRegisteredAgentByCredentialKeyContext(ctx context.Context, credentialKey string) (protocol.AgentRegistration, bool, error)
	RemoveRegisteredAgentContext(ctx context.Context, agentID string) error
}

type ContextAgentStore

type ContextAgentStore interface {
	ListAgentsContext(ctx context.Context) ([]protocol.AgentSummary, error)
	GetAgentContext(ctx context.Context, agentID string) (protocol.AgentSummary, bool, error)
}

type ContextLifecycleMessageStore

type ContextLifecycleMessageStore interface {
	AppendMessageWithLifecycleContext(ctx context.Context, message protocol.Message) (AppendLifecycle, error)
}

type ContextMessageStore

type ContextMessageStore interface {
	AppendMessageContext(ctx context.Context, message protocol.Message) error
	ListRoomMessagesContext(ctx context.Context, roomID string, page protocol.PageRequest) (protocol.MessagePage, error)
	ListThreadsContext(ctx context.Context, roomID string) ([]protocol.Thread, error)
	ListThreadMessagesContext(ctx context.Context, threadID string, page protocol.PageRequest) (protocol.MessagePage, error)
	ListDirectConversationsContext(ctx context.Context) ([]protocol.DirectConversation, error)
	GetDirectConversationContext(ctx context.Context, dmID string) (protocol.DirectConversation, bool, error)
	ListDMMessagesContext(ctx context.Context, dmID string, page protocol.PageRequest) (protocol.MessagePage, error)
	ListArtifactsContext(ctx context.Context, filter protocol.ArtifactFilter, page protocol.PageRequest) (protocol.ArtifactPage, error)
}

type ContextRoomStore

type ContextRoomStore interface {
	CreateRoomContext(ctx context.Context, room protocol.Room) error
	GetRoomContext(ctx context.Context, id string) (protocol.Room, bool, error)
	GetThreadContext(ctx context.Context, id string) (protocol.Thread, bool, error)
	ListRoomsContext(ctx context.Context) ([]protocol.Room, error)
	RemoveAgentContext(ctx context.Context, agentID string) error
	RemoveRoomContext(ctx context.Context, roomID string) error
	ReconcileRoomContext(ctx context.Context, room protocol.Room) (protocol.Room, error)
	UpdateRoomMembersContext(ctx context.Context, roomID string, add []string, remove []string) (protocol.Room, error)
}

type DuplicateMessageError added in v0.1.21

type DuplicateMessageError struct{ MessageID string }

DuplicateMessageError retains the stored ID when an origin retry uses a new ID.

func (*DuplicateMessageError) Error added in v0.1.21

func (e *DuplicateMessageError) Error() string

func (*DuplicateMessageError) Unwrap added in v0.1.21

func (e *DuplicateMessageError) Unwrap() error

type FileStore

type FileStore struct {
	*MemoryStore
	// contains filtered or unexported fields
}

func NewFileStore

func NewFileStore(path string) (*FileStore, error)

func (*FileStore) AcknowledgeAttachmentDeliveryContext added in v0.1.18

func (s *FileStore) AcknowledgeAttachmentDeliveryContext(
	_ context.Context,
	agentID string,
	eventID string,
) error

func (*FileStore) AppendMessage

func (s *FileStore) AppendMessage(message protocol.Message) error

func (*FileStore) AppendMessageContext

func (s *FileStore) AppendMessageContext(_ context.Context, message protocol.Message) error

func (*FileStore) AppendMessageEventWithLifecycleContext added in v0.1.18

func (s *FileStore) AppendMessageEventWithLifecycleContext(
	_ context.Context,
	message protocol.Message,
	event protocol.Event,
) (AppendLifecycle, error)

func (*FileStore) AppendMessageWithLifecycleContext

func (s *FileStore) AppendMessageWithLifecycleContext(_ context.Context, message protocol.Message) (AppendLifecycle, error)

func (*FileStore) AppendMessageWithPairingDeliveriesContext added in v0.1.21

func (s *FileStore) AppendMessageWithPairingDeliveriesContext(
	ctx context.Context, message protocol.Message, event *protocol.Event, pairingIDs []string,
) (AppendLifecycle, error)

func (*FileStore) ApplyPairingDeliveryResultsContext added in v0.1.21

func (s *FileStore) ApplyPairingDeliveryResultsContext(ctx context.Context, results []PairingDeliveryResult) error

func (*FileStore) BindPairingDeliveryDestinationContext added in v0.1.21

func (s *FileStore) BindPairingDeliveryDestinationContext(ctx context.Context, id, remote string) (int, error)

func (*FileStore) CompletePairingDeliveryContext added in v0.1.21

func (s *FileStore) CompletePairingDeliveryContext(ctx context.Context, pairingID, messageID string) error

func (*FileStore) CreateRoom

func (s *FileStore) CreateRoom(room protocol.Room) error

func (*FileStore) CreateRoomContext

func (s *FileStore) CreateRoomContext(_ context.Context, room protocol.Room) error

func (*FileStore) GetDirectConversationContext

func (s *FileStore) GetDirectConversationContext(ctx context.Context, dmID string) (protocol.DirectConversation, bool, error)

func (*FileStore) GetRoom

func (s *FileStore) GetRoom(id string) (protocol.Room, bool, error)

func (*FileStore) GetRoomContext

func (s *FileStore) GetRoomContext(ctx context.Context, id string) (protocol.Room, bool, error)

func (*FileStore) GetThread

func (s *FileStore) GetThread(id string) (protocol.Thread, bool, error)

func (*FileStore) GetThreadContext

func (s *FileStore) GetThreadContext(ctx context.Context, id string) (protocol.Thread, bool, error)

func (*FileStore) Health

func (s *FileStore) Health(context.Context) error

func (*FileStore) ListArtifacts

func (s *FileStore) ListArtifacts(filter protocol.ArtifactFilter, before string, limit int) (protocol.ArtifactPage, error)

func (*FileStore) ListArtifactsContext

func (s *FileStore) ListArtifactsContext(ctx context.Context, filter protocol.ArtifactFilter, page protocol.PageRequest) (protocol.ArtifactPage, error)

func (*FileStore) ListDMMessages

func (s *FileStore) ListDMMessages(dmID string, before string, limit int) (protocol.MessagePage, error)

func (*FileStore) ListDMMessagesContext

func (s *FileStore) ListDMMessagesContext(ctx context.Context, dmID string, page protocol.PageRequest) (protocol.MessagePage, error)

func (*FileStore) ListDirectConversations

func (s *FileStore) ListDirectConversations() ([]protocol.DirectConversation, error)

func (*FileStore) ListDirectConversationsContext

func (s *FileStore) ListDirectConversationsContext(ctx context.Context) ([]protocol.DirectConversation, error)

func (*FileStore) ListRoomMessages

func (s *FileStore) ListRoomMessages(roomID string, before string, limit int) (protocol.MessagePage, error)

func (*FileStore) ListRoomMessagesContext

func (s *FileStore) ListRoomMessagesContext(ctx context.Context, roomID string, page protocol.PageRequest) (protocol.MessagePage, error)

func (*FileStore) ListRooms

func (s *FileStore) ListRooms() ([]protocol.Room, error)

func (*FileStore) ListRoomsContext

func (s *FileStore) ListRoomsContext(ctx context.Context) ([]protocol.Room, error)

func (*FileStore) ListThreadMessages

func (s *FileStore) ListThreadMessages(threadID string, before string, limit int) (protocol.MessagePage, error)

func (*FileStore) ListThreadMessagesContext

func (s *FileStore) ListThreadMessagesContext(ctx context.Context, threadID string, page protocol.PageRequest) (protocol.MessagePage, error)

func (*FileStore) ListThreads

func (s *FileStore) ListThreads(roomID string) ([]protocol.Thread, error)

func (*FileStore) ListThreadsContext

func (s *FileStore) ListThreadsContext(ctx context.Context, roomID string) ([]protocol.Thread, error)

func (*FileStore) PrepareAttachmentDeliveryContext added in v0.1.18

func (s *FileStore) PrepareAttachmentDeliveryContext(
	_ context.Context,
	agentID string,
) ([]protocol.Event, error)

func (*FileStore) PrunePairingDeliveriesContext added in v0.1.21

func (s *FileStore) PrunePairingDeliveriesContext(
	ctx context.Context, pairingID string, now time.Time, maxAge time.Duration, maxPending int,
) (int, error)

func (*FileStore) ReconcilePairingDeliveriesContext added in v0.1.21

func (s *FileStore) ReconcilePairingDeliveriesContext(ctx context.Context, destinations map[string]string) (map[string]int, error)

func (*FileStore) ReconcileRegisteredAgentContext added in v0.1.12

func (s *FileStore) ReconcileRegisteredAgentContext(
	_ context.Context,
	registration protocol.AgentRegistration,
) (protocol.AgentRegistration, error)

func (*FileStore) ReconcileRoom added in v0.1.11

func (s *FileStore) ReconcileRoom(room protocol.Room) (protocol.Room, error)

func (*FileStore) ReconcileRoomContext added in v0.1.11

func (s *FileStore) ReconcileRoomContext(_ context.Context, room protocol.Room) (protocol.Room, error)

func (*FileStore) RegisterAgentContext

func (s *FileStore) RegisterAgentContext(
	_ context.Context,
	registration protocol.AgentRegistration,
) (RegistrationResult, error)

func (*FileStore) RemoveAgent added in v0.1.10

func (s *FileStore) RemoveAgent(agentID string) error

func (*FileStore) RemoveAgentContext added in v0.1.10

func (s *FileStore) RemoveAgentContext(_ context.Context, agentID string) error

func (*FileStore) RemoveRegisteredAgentContext added in v0.1.10

func (s *FileStore) RemoveRegisteredAgentContext(_ context.Context, agentID string) error

func (*FileStore) RemoveRoom added in v0.1.10

func (s *FileStore) RemoveRoom(roomID string) error

func (*FileStore) RemoveRoomContext added in v0.1.10

func (s *FileStore) RemoveRoomContext(_ context.Context, roomID string) error

func (*FileStore) SetFollowCheckpoint added in v0.1.20

func (s *FileStore) SetFollowCheckpoint(ctx context.Context, key string, value follow.Checkpoint) error

func (*FileStore) SetFollowCheckpoints added in v0.1.20

func (s *FileStore) SetFollowCheckpoints(ctx context.Context, values map[string]follow.Checkpoint, deletePrefixes []string) error

func (*FileStore) UpdatePairingDeliveryContext added in v0.1.21

func (s *FileStore) UpdatePairingDeliveryContext(ctx context.Context, delivery PairingDelivery, lastError string) error

func (*FileStore) UpdateRoomMembers

func (s *FileStore) UpdateRoomMembers(roomID string, add []string, remove []string) (protocol.Room, error)

func (*FileStore) UpdateRoomMembersContext

func (s *FileStore) UpdateRoomMembersContext(
	_ context.Context,
	roomID string,
	add []string,
	remove []string,
) (protocol.Room, error)

type HealthChecker

type HealthChecker interface {
	Health(context.Context) error
}

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) AcknowledgeAttachmentDeliveryContext added in v0.1.18

func (s *MemoryStore) AcknowledgeAttachmentDeliveryContext(
	_ context.Context,
	agentID string,
	eventID string,
) error

func (*MemoryStore) AppendMessage

func (s *MemoryStore) AppendMessage(message protocol.Message) error

func (*MemoryStore) AppendMessageContext

func (s *MemoryStore) AppendMessageContext(_ context.Context, message protocol.Message) error

func (*MemoryStore) AppendMessageEventWithLifecycleContext added in v0.1.18

func (s *MemoryStore) AppendMessageEventWithLifecycleContext(
	ctx context.Context,
	message protocol.Message,
	event protocol.Event,
) (AppendLifecycle, error)

func (*MemoryStore) AppendMessageWithLifecycleContext

func (s *MemoryStore) AppendMessageWithLifecycleContext(_ context.Context, message protocol.Message) (AppendLifecycle, error)

func (*MemoryStore) AppendMessageWithPairingDeliveriesContext added in v0.1.21

func (s *MemoryStore) AppendMessageWithPairingDeliveriesContext(
	ctx context.Context, message protocol.Message, event *protocol.Event, pairingIDs []string,
) (AppendLifecycle, error)

func (*MemoryStore) ApplyPairingDeliveryResultsContext added in v0.1.21

func (s *MemoryStore) ApplyPairingDeliveryResultsContext(_ context.Context, results []PairingDeliveryResult) error

func (*MemoryStore) BindPairingDeliveryDestinationContext added in v0.1.21

func (s *MemoryStore) BindPairingDeliveryDestinationContext(_ context.Context, id, remote string) (int, error)

Discovery binds the queue and its durable default in the same critical section.

func (*MemoryStore) CompletePairingDeliveryContext added in v0.1.21

func (s *MemoryStore) CompletePairingDeliveryContext(_ context.Context, pairingID, messageID string) error

func (*MemoryStore) CreateRoom

func (s *MemoryStore) CreateRoom(room protocol.Room) error

func (*MemoryStore) CreateRoomContext

func (s *MemoryStore) CreateRoomContext(_ context.Context, room protocol.Room) error

func (*MemoryStore) GetAgentContext

func (s *MemoryStore) GetAgentContext(_ context.Context, agentID string) (protocol.AgentSummary, bool, error)

func (*MemoryStore) GetDirectConversationContext

func (s *MemoryStore) GetDirectConversationContext(
	_ context.Context,
	dmID string,
) (protocol.DirectConversation, bool, error)

func (*MemoryStore) GetFollowCheckpoint added in v0.1.20

func (s *MemoryStore) GetFollowCheckpoint(_ context.Context, key string) (follow.Checkpoint, error)

func (*MemoryStore) GetRegisteredAgentByCredentialKeyContext added in v0.1.1

func (s *MemoryStore) GetRegisteredAgentByCredentialKeyContext(
	_ context.Context,
	credentialKey string,
) (protocol.AgentRegistration, bool, error)

func (*MemoryStore) GetRegisteredAgentContext

func (s *MemoryStore) GetRegisteredAgentContext(
	_ context.Context,
	agentID string,
) (protocol.AgentRegistration, bool, error)

func (*MemoryStore) GetRoom

func (s *MemoryStore) GetRoom(id string) (protocol.Room, bool, error)

func (*MemoryStore) GetRoomContext

func (s *MemoryStore) GetRoomContext(_ context.Context, id string) (protocol.Room, bool, error)

func (*MemoryStore) GetThread

func (s *MemoryStore) GetThread(id string) (protocol.Thread, bool, error)

func (*MemoryStore) GetThreadContext

func (s *MemoryStore) GetThreadContext(_ context.Context, id string) (protocol.Thread, bool, error)

func (*MemoryStore) Health

func (s *MemoryStore) Health(context.Context) error

func (*MemoryStore) ListAgentsContext

func (s *MemoryStore) ListAgentsContext(_ context.Context) ([]protocol.AgentSummary, error)

func (*MemoryStore) ListArtifacts

func (s *MemoryStore) ListArtifacts(
	filter protocol.ArtifactFilter,
	before string,
	limit int,
) (protocol.ArtifactPage, error)

func (*MemoryStore) ListArtifactsContext

func (s *MemoryStore) ListArtifactsContext(
	_ context.Context,
	filter protocol.ArtifactFilter,
	page protocol.PageRequest,
) (protocol.ArtifactPage, error)

func (*MemoryStore) ListDMMessages

func (s *MemoryStore) ListDMMessages(dmID string, before string, limit int) (protocol.MessagePage, error)

func (*MemoryStore) ListDMMessagesContext

func (s *MemoryStore) ListDMMessagesContext(
	_ context.Context,
	dmID string,
	page protocol.PageRequest,
) (protocol.MessagePage, error)

func (*MemoryStore) ListDirectConversations

func (s *MemoryStore) ListDirectConversations() ([]protocol.DirectConversation, error)

func (*MemoryStore) ListDirectConversationsContext

func (s *MemoryStore) ListDirectConversationsContext(_ context.Context) ([]protocol.DirectConversation, error)

func (*MemoryStore) ListPairingDeliveryHeadsContext added in v0.1.21

func (s *MemoryStore) ListPairingDeliveryHeadsContext(_ context.Context) ([]PairingDelivery, error)

func (*MemoryStore) ListRegisteredAgentsContext

func (s *MemoryStore) ListRegisteredAgentsContext(_ context.Context) ([]protocol.AgentRegistration, error)

func (*MemoryStore) ListRoomMessages

func (s *MemoryStore) ListRoomMessages(roomID string, before string, limit int) (protocol.MessagePage, error)

func (*MemoryStore) ListRoomMessagesContext

func (s *MemoryStore) ListRoomMessagesContext(
	_ context.Context,
	roomID string,
	page protocol.PageRequest,
) (protocol.MessagePage, error)

func (*MemoryStore) ListRooms

func (s *MemoryStore) ListRooms() ([]protocol.Room, error)

func (*MemoryStore) ListRoomsContext

func (s *MemoryStore) ListRoomsContext(_ context.Context) ([]protocol.Room, error)

func (*MemoryStore) ListThreadMessages

func (s *MemoryStore) ListThreadMessages(threadID string, before string, limit int) (protocol.MessagePage, error)

func (*MemoryStore) ListThreadMessagesContext

func (s *MemoryStore) ListThreadMessagesContext(
	_ context.Context,
	threadID string,
	page protocol.PageRequest,
) (protocol.MessagePage, error)

func (*MemoryStore) ListThreads

func (s *MemoryStore) ListThreads(roomID string) ([]protocol.Thread, error)

func (*MemoryStore) ListThreadsContext

func (s *MemoryStore) ListThreadsContext(_ context.Context, roomID string) ([]protocol.Thread, error)

func (*MemoryStore) PairingDeliveryStateContext added in v0.1.21

func (s *MemoryStore) PairingDeliveryStateContext(_ context.Context, pairingID string) (PairingDeliveryState, error)

func (*MemoryStore) PrepareAttachmentDeliveryContext added in v0.1.18

func (s *MemoryStore) PrepareAttachmentDeliveryContext(
	_ context.Context,
	agentID string,
) ([]protocol.Event, error)

func (*MemoryStore) PrunePairingDeliveriesContext added in v0.1.21

func (s *MemoryStore) PrunePairingDeliveriesContext(
	_ context.Context, pairingID string, now time.Time, maxAge time.Duration, maxPending int,
) (int, error)

func (*MemoryStore) ReconcilePairingDeliveriesContext added in v0.1.21

func (s *MemoryStore) ReconcilePairingDeliveriesContext(_ context.Context, destinations map[string]string) (map[string]int, error)

Empty destinations and rows are unbound, not evidence of a changed peer.

func (*MemoryStore) ReconcileRegisteredAgentContext added in v0.1.12

func (s *MemoryStore) ReconcileRegisteredAgentContext(
	_ context.Context,
	registration protocol.AgentRegistration,
) (protocol.AgentRegistration, error)

func (*MemoryStore) ReconcileRoom added in v0.1.11

func (s *MemoryStore) ReconcileRoom(room protocol.Room) (protocol.Room, error)

func (*MemoryStore) ReconcileRoomContext added in v0.1.11

func (s *MemoryStore) ReconcileRoomContext(_ context.Context, room protocol.Room) (protocol.Room, error)

func (*MemoryStore) RegisterAgentContext

func (s *MemoryStore) RegisterAgentContext(
	_ context.Context,
	registration protocol.AgentRegistration,
) (RegistrationResult, error)

func (*MemoryStore) RemoveAgent added in v0.1.10

func (s *MemoryStore) RemoveAgent(agentID string) error

func (*MemoryStore) RemoveAgentContext added in v0.1.10

func (s *MemoryStore) RemoveAgentContext(_ context.Context, agentID string) error

func (*MemoryStore) RemoveRegisteredAgentContext added in v0.1.10

func (s *MemoryStore) RemoveRegisteredAgentContext(_ context.Context, agentID string) error

func (*MemoryStore) RemoveRoom added in v0.1.10

func (s *MemoryStore) RemoveRoom(roomID string) error

func (*MemoryStore) RemoveRoomContext added in v0.1.10

func (s *MemoryStore) RemoveRoomContext(_ context.Context, roomID string) error

func (*MemoryStore) SetFollowCheckpoint added in v0.1.20

func (s *MemoryStore) SetFollowCheckpoint(ctx context.Context, key string, value follow.Checkpoint) error

func (*MemoryStore) SetFollowCheckpoints added in v0.1.20

func (s *MemoryStore) SetFollowCheckpoints(ctx context.Context, values map[string]follow.Checkpoint, deletePrefixes []string) error

SetFollowCheckpoints deletes literal prefixes before applying replacements. The whole page is visible atomically to checkpoint readers.

func (*MemoryStore) UpdatePairingDeliveryContext added in v0.1.21

func (s *MemoryStore) UpdatePairingDeliveryContext(_ context.Context, delivery PairingDelivery, lastError string) error

func (*MemoryStore) UpdateRoomMembers

func (s *MemoryStore) UpdateRoomMembers(roomID string, add []string, remove []string) (protocol.Room, error)

func (*MemoryStore) UpdateRoomMembersContext

func (s *MemoryStore) UpdateRoomMembersContext(
	_ context.Context,
	roomID string,
	add []string,
	remove []string,
) (protocol.Room, error)

type MessageStore

type MessageStore interface {
	AppendMessage(message protocol.Message) error
	ListRoomMessages(roomID string, before string, limit int) (protocol.MessagePage, error)
	ListThreads(roomID string) ([]protocol.Thread, error)
	ListThreadMessages(threadID string, before string, limit int) (protocol.MessagePage, error)
	ListDirectConversations() ([]protocol.DirectConversation, error)
	ListDMMessages(dmID string, before string, limit int) (protocol.MessagePage, error)
	ListArtifacts(filter protocol.ArtifactFilter, before string, limit int) (protocol.ArtifactPage, error)
}

type PairingDelivery added in v0.1.21

type PairingDelivery struct {
	Sequence        int64
	PairingID       string
	RemoteNetworkID string
	MessageID       string
	Message         protocol.Message
	Attempts        int
	NextAttempt     time.Time
	CreatedAt       time.Time
}

PairingDelivery is an outbound record committed with the originating message. Sequence orders accepted messages independently of caller timestamps and IDs.

type PairingDeliveryLimits added in v0.1.21

type PairingDeliveryLimits struct {
	RemoteNetworkID string
	MaxAge          time.Duration
	MaxPending      int
}

PairingDeliveryLimits apply in the same transaction as the message append.

type PairingDeliveryResult added in v0.1.21

type PairingDeliveryResult struct {
	Delivery       PairingDelivery
	LastError      string
	RejectedReason string
	Retry          bool
}

PairingDeliveryResult is persisted with the other completed sends in one worker pass. The full delivery identity prevents stale results from changing replacement rows.

type PairingDeliveryState added in v0.1.21

type PairingDeliveryState struct {
	RemoteNetworkID     string
	Pending             int
	OldestPendingAt     time.Time
	LastError           string
	Dropped             int64
	Rejected            int64
	LastRejectionReason string
}

type PairingDeliveryStore added in v0.1.21

type PairingDeliveryStore interface {
	BindPairingDeliveryDestinationContext(context.Context, string, string) (int, error)
	ApplyPairingDeliveryResultsContext(context.Context, []PairingDeliveryResult) error
	ReconcilePairingDeliveriesContext(context.Context, map[string]string) (map[string]int, error)
	AppendMessageWithPairingDeliveriesContext(context.Context, protocol.Message, *protocol.Event, []string) (AppendLifecycle, error)
	ListPairingDeliveryHeadsContext(context.Context) ([]PairingDelivery, error)
	UpdatePairingDeliveryContext(context.Context, PairingDelivery, string) error
	CompletePairingDeliveryContext(context.Context, string, string) error
	PrunePairingDeliveriesContext(context.Context, string, time.Time, time.Duration, int) (int, error)
	PairingDeliveryStateContext(context.Context, string) (PairingDeliveryState, error)
}

type RegistrationResult added in v0.1.19

type RegistrationResult struct {
	protocol.AgentRegistration
	Created bool
}

RegistrationResult records the outcome of the atomic registration operation. Created is independent of clock precision and is never part of the wire schema.

type RoomStore

type RoomStore interface {
	CreateRoom(room protocol.Room) error
	GetRoom(id string) (protocol.Room, bool, error)
	GetThread(id string) (protocol.Thread, bool, error)
	ListRooms() ([]protocol.Room, error)
	RemoveAgent(agentID string) error
	RemoveRoom(roomID string) error
	ReconcileRoom(room protocol.Room) (protocol.Room, error)
	UpdateRoomMembers(roomID string, add []string, remove []string) (protocol.Room, error)
}

type SQLStore

type SQLStore struct {
	// contains filtered or unexported fields
}

func NewPostgresStore

func NewPostgresStore(dsn string) (*SQLStore, error)

func NewSQLiteStore

func NewSQLiteStore(path string) (*SQLStore, error)

func (*SQLStore) AcknowledgeAttachmentDeliveryContext added in v0.1.18

func (s *SQLStore) AcknowledgeAttachmentDeliveryContext(
	ctx context.Context,
	agentID string,
	eventID string,
) error

func (*SQLStore) AppendMessage

func (s *SQLStore) AppendMessage(message protocol.Message) error

func (*SQLStore) AppendMessageContext

func (s *SQLStore) AppendMessageContext(ctx context.Context, message protocol.Message) error

func (*SQLStore) AppendMessageEventWithLifecycleContext added in v0.1.18

func (s *SQLStore) AppendMessageEventWithLifecycleContext(
	ctx context.Context,
	message protocol.Message,
	event protocol.Event,
) (AppendLifecycle, error)

func (*SQLStore) AppendMessageWithLifecycleContext

func (s *SQLStore) AppendMessageWithLifecycleContext(ctx context.Context, message protocol.Message) (AppendLifecycle, error)

func (*SQLStore) AppendMessageWithPairingDeliveriesContext added in v0.1.21

func (s *SQLStore) AppendMessageWithPairingDeliveriesContext(
	ctx context.Context, message protocol.Message, event *protocol.Event, pairingIDs []string,
) (AppendLifecycle, error)

func (*SQLStore) ApplyPairingDeliveryResultsContext added in v0.1.21

func (s *SQLStore) ApplyPairingDeliveryResultsContext(ctx context.Context, results []PairingDeliveryResult) error

func (*SQLStore) BindPairingDeliveryDestinationContext added in v0.1.21

func (s *SQLStore) BindPairingDeliveryDestinationContext(ctx context.Context, id, remote string) (int, error)

func (*SQLStore) Close

func (s *SQLStore) Close() error

func (*SQLStore) CompletePairingDeliveryContext added in v0.1.21

func (s *SQLStore) CompletePairingDeliveryContext(ctx context.Context, pairingID, messageID string) error

func (*SQLStore) CreateRoom

func (s *SQLStore) CreateRoom(room protocol.Room) error

func (*SQLStore) CreateRoomContext

func (s *SQLStore) CreateRoomContext(ctx context.Context, room protocol.Room) error

func (*SQLStore) GetAgentContext

func (s *SQLStore) GetAgentContext(ctx context.Context, agentID string) (protocol.AgentSummary, bool, error)

func (*SQLStore) GetDirectConversationContext

func (s *SQLStore) GetDirectConversationContext(
	ctx context.Context,
	dmID string,
) (protocol.DirectConversation, bool, error)

func (*SQLStore) GetFollowCheckpoint added in v0.1.20

func (s *SQLStore) GetFollowCheckpoint(ctx context.Context, key string) (follow.Checkpoint, error)

func (*SQLStore) GetRegisteredAgentByCredentialKeyContext added in v0.1.1

func (s *SQLStore) GetRegisteredAgentByCredentialKeyContext(
	ctx context.Context,
	credentialKey string,
) (protocol.AgentRegistration, bool, error)

func (*SQLStore) GetRegisteredAgentContext

func (s *SQLStore) GetRegisteredAgentContext(
	ctx context.Context,
	agentID string,
) (protocol.AgentRegistration, bool, error)

func (*SQLStore) GetRoom

func (s *SQLStore) GetRoom(id string) (protocol.Room, bool, error)

func (*SQLStore) GetRoomContext

func (s *SQLStore) GetRoomContext(ctx context.Context, id string) (protocol.Room, bool, error)

func (*SQLStore) GetThread

func (s *SQLStore) GetThread(id string) (protocol.Thread, bool, error)

func (*SQLStore) GetThreadContext

func (s *SQLStore) GetThreadContext(ctx context.Context, id string) (protocol.Thread, bool, error)

func (*SQLStore) Health

func (s *SQLStore) Health(ctx context.Context) error

func (*SQLStore) ListAgentsContext

func (s *SQLStore) ListAgentsContext(ctx context.Context) ([]protocol.AgentSummary, error)

func (*SQLStore) ListArtifacts

func (s *SQLStore) ListArtifacts(filter protocol.ArtifactFilter, before string, limit int) (protocol.ArtifactPage, error)

func (*SQLStore) ListArtifactsContext

func (s *SQLStore) ListArtifactsContext(
	ctx context.Context,
	filter protocol.ArtifactFilter,
	page protocol.PageRequest,
) (protocol.ArtifactPage, error)

func (*SQLStore) ListDMMessages

func (s *SQLStore) ListDMMessages(dmID string, before string, limit int) (protocol.MessagePage, error)

func (*SQLStore) ListDMMessagesContext

func (s *SQLStore) ListDMMessagesContext(
	ctx context.Context,
	dmID string,
	page protocol.PageRequest,
) (protocol.MessagePage, error)

func (*SQLStore) ListDirectConversations

func (s *SQLStore) ListDirectConversations() ([]protocol.DirectConversation, error)

func (*SQLStore) ListDirectConversationsContext

func (s *SQLStore) ListDirectConversationsContext(ctx context.Context) ([]protocol.DirectConversation, error)

func (*SQLStore) ListPairingDeliveryHeadsContext added in v0.1.21

func (s *SQLStore) ListPairingDeliveryHeadsContext(ctx context.Context) ([]PairingDelivery, error)

func (*SQLStore) ListRegisteredAgentsContext

func (s *SQLStore) ListRegisteredAgentsContext(ctx context.Context) ([]protocol.AgentRegistration, error)

func (*SQLStore) ListRoomMessages

func (s *SQLStore) ListRoomMessages(roomID string, before string, limit int) (protocol.MessagePage, error)

func (*SQLStore) ListRoomMessagesContext

func (s *SQLStore) ListRoomMessagesContext(
	ctx context.Context,
	roomID string,
	page protocol.PageRequest,
) (protocol.MessagePage, error)

func (*SQLStore) ListRooms

func (s *SQLStore) ListRooms() ([]protocol.Room, error)

func (*SQLStore) ListRoomsContext

func (s *SQLStore) ListRoomsContext(ctx context.Context) ([]protocol.Room, error)

func (*SQLStore) ListThreadMessages

func (s *SQLStore) ListThreadMessages(threadID string, before string, limit int) (protocol.MessagePage, error)

func (*SQLStore) ListThreadMessagesContext

func (s *SQLStore) ListThreadMessagesContext(
	ctx context.Context,
	threadID string,
	page protocol.PageRequest,
) (protocol.MessagePage, error)

func (*SQLStore) ListThreads

func (s *SQLStore) ListThreads(roomID string) ([]protocol.Thread, error)

func (*SQLStore) ListThreadsContext

func (s *SQLStore) ListThreadsContext(ctx context.Context, roomID string) ([]protocol.Thread, error)

func (*SQLStore) PairingDeliveryStateContext added in v0.1.21

func (s *SQLStore) PairingDeliveryStateContext(ctx context.Context, pairingID string) (PairingDeliveryState, error)

func (*SQLStore) PrepareAttachmentDeliveryContext added in v0.1.18

func (s *SQLStore) PrepareAttachmentDeliveryContext(
	ctx context.Context,
	agentID string,
) ([]protocol.Event, error)

func (*SQLStore) PrunePairingDeliveriesContext added in v0.1.21

func (s *SQLStore) PrunePairingDeliveriesContext(
	ctx context.Context, pairingID string, now time.Time, maxAge time.Duration, maxPending int,
) (int, error)

func (*SQLStore) ReconcilePairingDeliveriesContext added in v0.1.21

func (s *SQLStore) ReconcilePairingDeliveriesContext(ctx context.Context, destinations map[string]string) (map[string]int, error)

func (*SQLStore) ReconcileRegisteredAgentContext added in v0.1.12

func (s *SQLStore) ReconcileRegisteredAgentContext(
	ctx context.Context,
	registration protocol.AgentRegistration,
) (protocol.AgentRegistration, error)

func (*SQLStore) ReconcileRoom added in v0.1.11

func (s *SQLStore) ReconcileRoom(room protocol.Room) (protocol.Room, error)

func (*SQLStore) ReconcileRoomContext added in v0.1.11

func (s *SQLStore) ReconcileRoomContext(ctx context.Context, room protocol.Room) (protocol.Room, error)

func (*SQLStore) RegisterAgentContext

func (s *SQLStore) RegisterAgentContext(
	ctx context.Context,
	registration protocol.AgentRegistration,
) (RegistrationResult, error)

func (*SQLStore) RemoveAgent added in v0.1.10

func (s *SQLStore) RemoveAgent(agentID string) error

func (*SQLStore) RemoveAgentContext added in v0.1.10

func (s *SQLStore) RemoveAgentContext(ctx context.Context, agentID string) error

func (*SQLStore) RemoveRegisteredAgentContext added in v0.1.10

func (s *SQLStore) RemoveRegisteredAgentContext(ctx context.Context, agentID string) error

func (*SQLStore) RemoveRoom added in v0.1.10

func (s *SQLStore) RemoveRoom(roomID string) error

func (*SQLStore) RemoveRoomContext added in v0.1.10

func (s *SQLStore) RemoveRoomContext(ctx context.Context, roomID string) error

func (*SQLStore) SetFollowCheckpoint added in v0.1.20

func (s *SQLStore) SetFollowCheckpoint(ctx context.Context, key string, value follow.Checkpoint) error

func (*SQLStore) SetFollowCheckpoints added in v0.1.20

func (s *SQLStore) SetFollowCheckpoints(ctx context.Context, values map[string]follow.Checkpoint, deletePrefixes []string) error

func (*SQLStore) SetNow added in v0.1.19

func (s *SQLStore) SetNow(now func() (time.Time, error))

SetNow injects domain time before serving requests. Migrations, connection timeouts and health deadlines intentionally remain on the real clock.

func (*SQLStore) UpdatePairingDeliveryContext added in v0.1.21

func (s *SQLStore) UpdatePairingDeliveryContext(ctx context.Context, delivery PairingDelivery, lastError string) error

func (*SQLStore) UpdateRoomMembers

func (s *SQLStore) UpdateRoomMembers(roomID string, add []string, remove []string) (protocol.Room, error)

func (*SQLStore) UpdateRoomMembersContext

func (s *SQLStore) UpdateRoomMembersContext(
	ctx context.Context,
	roomID string,
	add []string,
	remove []string,
) (protocol.Room, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL