daemon

package
v1.22.88 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package daemon implements the store-and-forward inbox for service nodes. It handles message storage, delivery, deduplication, and quota management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inbox

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

Inbox manages message storage and retrieval for a service node

func NewInbox

func NewInbox(db database.Database, config *servicenodevm.Config, nodeID ids.NodeID) *Inbox

NewInbox creates a new message inbox

func (*Inbox) ComputeStoreRoot

func (i *Inbox) ComputeStoreRoot() [32]byte

ComputeStoreRoot computes the Merkle root of stored messages

func (*Inbox) CreateStorageCommitment

func (i *Inbox) CreateStorageCommitment(epochID uint64) *servicenodevm.StorageCommitment

CreateStorageCommitment creates a storage commitment for an epoch

func (*Inbox) Delete

func (i *Inbox) Delete(ctx context.Context, msgID ids.ID, accountID [32]byte) error

Delete deletes a message

func (*Inbox) Fetch

func (i *Inbox) Fetch(ctx context.Context, accountID [32]byte, afterTimestamp time.Time, limit int) ([]*servicenodevm.StoredMessage, error)

Fetch retrieves messages for an account

func (*Inbox) FetchByID

func (i *Inbox) FetchByID(ctx context.Context, msgID ids.ID) (*servicenodevm.StoredMessage, error)

FetchByID retrieves a specific message by ID

func (*Inbox) GetMessageCount

func (i *Inbox) GetMessageCount(accountID [32]byte) int

GetMessageCount returns the number of messages for an account

func (*Inbox) GetQuota

func (i *Inbox) GetQuota(accountID [32]byte) (used, total uint64)

GetQuota returns the current quota usage for an account

func (*Inbox) GetStats

func (i *Inbox) GetStats() *InboxStats

GetStats returns inbox statistics

func (*Inbox) Load

func (i *Inbox) Load(ctx context.Context) error

Load loads inbox state from database

func (*Inbox) MarkDelivered

func (i *Inbox) MarkDelivered(ctx context.Context, msgID ids.ID) error

MarkDelivered marks a message as delivered

func (*Inbox) PruneExpired

func (i *Inbox) PruneExpired(ctx context.Context) (int, error)

PruneExpired removes expired messages

func (*Inbox) Store

func (i *Inbox) Store(ctx context.Context, msg *servicenodevm.StoredMessage) error

Store stores a message in the inbox

type InboxStats

type InboxStats struct {
	TotalMessages  uint64 `json:"totalMessages"`
	TotalSize      uint64 `json:"totalSize"`
	DeliveredCount uint64 `json:"deliveredCount"`
	AccountCount   uint64 `json:"accountCount"`
}

InboxStats holds inbox statistics

Jump to

Keyboard shortcuts

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