result

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResultStorage

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

ResultStorage provides methods for storing and retrieving action responses.

mu serialises StoreResponse so the override-guard read-then-write stays atomic; reads do not take it.

func NewStorage

func NewStorage(s storage.Storage[*types.ActionResponse], n storage.Notifier, resultTTL, submitResultTTL time.Duration) *ResultStorage

NewStorage builds a ResultStorage. resultTTL applies to Threshold/End results, submitResultTTL to Submit results.

func (*ResultStorage) FetchResponse added in v0.0.18

func (rs *ResultStorage) FetchResponse(ctx context.Context, actionID common.Hash, submissionTag types.SubmissionTag) (*types.ActionResponse, error)

FetchResponse returns action response for action id and submission tag.

func (*ResultStorage) StoreResponse

func (rs *ResultStorage) StoreResponse(ctx context.Context, response *types.ActionResponse) error

StoreResponse stores response under actionID:submissionTag with the appropriate TTL.

func (*ResultStorage) WaitOnResponse

func (rs *ResultStorage) WaitOnResponse(ctx context.Context, actionID common.Hash, submissionTag types.SubmissionTag, timeout time.Duration) (*types.ActionResponse, error)

WaitOnResponse blocks until the response for actionID/submissionTag is stored, ctx is cancelled, or timeout elapses (whichever comes first). A non-positive timeout disables the timer; ctx is still honoured. Use only when the action is expected to be processed.

type Service

type Service struct {

	// A channel for key update actions (KEY_GENERATE, KEY_DATA_PROVIDER_RESTORE,
	// KEY_DIRECT_RESTORE, KEY_DELETE)
	KeyActions chan *types.ActionResult
	// A channel for backup actions (TEE_BACKUP)
	Backups chan *types.ActionResult
	// A channel for backup trigger actions (UPDATE_POLICY)
	BackupTrigger chan bool
	// contains filtered or unexported fields
}

Service handles processing and storage of TEE action results.

func NewService

func NewService(rs *ResultStorage, chainID uint64, m *metrics.Metrics) *Service

NewService creates a new result service. chainID is bound into the domain-separated preimage used to verify the TEE's action-result signature. m may be nil or disabled.

func (*Service) LastStorageErr added in v0.0.18

func (s *Service) LastStorageErr() error

LastStorageErr returns the most recent StoreResponse error, or nil if the last attempt succeeded. Auto-recovers: cleared by the next successful store.

func (*Service) ProcessAndStore

func (s *Service) ProcessAndStore(ctx context.Context, r *types.ActionResponse) error

ProcessAndStore stores response into database and triggers appropriate hooks.

func (*Service) Serve

func (s *Service) Serve(ctx context.Context, actionID common.Hash, submissionTag types.SubmissionTag) (*types.ActionResponse, error)

Serve returns response for actionID with provided submissionTag if present.

func (*Service) SetIdentity

func (s *Service) SetIdentity(teeID common.Address) error

SetIdentity sets the TEE identity for the service. It can only be set once.

Jump to

Keyboard shortcuts

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