daemon

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package daemon implements the sessiond service node daemon. This is the off-chain component that runs session workloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeSessionCreateRequest

func EncodeSessionCreateRequest(req *SessionCreateRequest) []byte

EncodeSessionCreateRequest encodes a session create request to bytes.

Types

type AttestationMessage

type AttestationMessage struct {
	SessionID     core.ID
	StepIndex     uint32
	CommitRoot    core.ID
	AttestationID core.ID
	OutputHash    core.ID
}

AttestationMessage is the payload for attestation messages.

func DecodeAttestationMessage

func DecodeAttestationMessage(data []byte) (*AttestationMessage, error)

DecodeAttestationMessage decodes an attestation message.

type Config

type Config struct {
	// NodeID is this node's identifier
	NodeID core.ID

	// ListenAddr is the address to listen on
	ListenAddr string

	// BootstrapPeers are initial peers to connect to
	BootstrapPeers []string

	// DataDir is the directory for persistent data
	DataDir string

	// MaxSessions is the maximum concurrent sessions
	MaxSessions int

	// SessionTimeout is the timeout for session execution
	SessionTimeout time.Duration

	// HeartbeatInterval is the interval between heartbeats
	HeartbeatInterval time.Duration
}

Config holds the daemon configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default daemon configuration.

type OracleCommitMessage

type OracleCommitMessage struct {
	RequestID core.ID
}

OracleCommitMessage is the payload for oracle commit messages.

type OracleRecordMessage

type OracleRecordMessage struct {
	RequestID   core.ID
	SubmitterID core.ID
	Data        []byte
	Signature   []byte
}

OracleRecordMessage is the payload for oracle record submissions.

func DecodeOracleRecordMessage

func DecodeOracleRecordMessage(data []byte) (*OracleRecordMessage, error)

DecodeOracleRecordMessage decodes an oracle record message.

type OracleRequestMessage

type OracleRequestMessage struct {
	SessionID core.ID
	StepKind  core.StepKind
	TxID      core.ID
	InputHash core.ID
}

OracleRequestMessage is the payload for oracle request messages.

func DecodeOracleRequestMessage

func DecodeOracleRequestMessage(data []byte) (*OracleRequestMessage, error)

DecodeOracleRequestMessage decodes an oracle request message.

type Service

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

Service is the main sessiond service.

func New

func New(config *Config) *Service

New creates a new sessiond service.

func (*Service) CreateSession

func (s *Service) CreateSession(serviceID core.ID, epoch uint64, txID core.ID, committee []core.ID) (*core.Session, error)

CreateSession creates a new session.

func (*Service) FinalizeSession

func (s *Service) FinalizeSession(sessionID, outputHash, oracleRoot, receiptsRoot core.ID) error

FinalizeSession finalizes a session.

func (*Service) GetSession

func (s *Service) GetSession(sessionID core.ID) (*core.Session, error)

GetSession retrieves a session by ID.

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start starts the service.

func (*Service) StartSession

func (s *Service) StartSession(sessionID core.ID) error

StartSession starts a session.

func (*Service) Stop

func (s *Service) Stop() error

Stop stops the service.

type SessionCreateRequest

type SessionCreateRequest struct {
	ServiceID core.ID
	Epoch     uint64
	TxID      core.ID
	Committee []core.ID
}

SessionCreateRequest is the payload for session creation.

func DecodeSessionCreateRequest

func DecodeSessionCreateRequest(data []byte) (*SessionCreateRequest, error)

DecodeSessionCreateRequest decodes a session create request from bytes.

type SessionRunner

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

SessionRunner manages the execution of a single session.

func NewSessionRunner

func NewSessionRunner(service *Service, session *core.Session) *SessionRunner

NewSessionRunner creates a new session runner.

func (*SessionRunner) CompleteStep

func (r *SessionRunner) CompleteStep(stepIndex uint32, oracleCommitRoot, attestationID, outputHash core.ID) error

CompleteStep completes a step with attestation.

func (*SessionRunner) CreateOracleRequest

func (r *SessionRunner) CreateOracleRequest(kind core.StepKind, txID, inputHash core.ID) (*protocol.OracleRequest, error)

CreateOracleRequest creates an oracle request for the session.

func (*SessionRunner) Finalize

func (r *SessionRunner) Finalize(outputHash, oracleRoot, receiptsRoot core.ID) error

Finalize finalizes the session.

func (*SessionRunner) Session

func (r *SessionRunner) Session() *core.Session

Session returns the underlying session.

func (*SessionRunner) Start

func (r *SessionRunner) Start(ctx context.Context) error

Start starts the session execution.

func (*SessionRunner) Stop

func (r *SessionRunner) Stop()

Stop stops the session execution.

Jump to

Keyboard shortcuts

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