Documentation
¶
Index ¶
- type ResultStorage
- func (rs *ResultStorage) FetchResponse(ctx context.Context, actionID common.Hash, submissionTag types.SubmissionTag) (*types.ActionResponse, error)
- func (rs *ResultStorage) StoreResponse(ctx context.Context, response *types.ActionResponse) error
- func (rs *ResultStorage) WaitOnResponse(ctx context.Context, actionID common.Hash, submissionTag types.SubmissionTag, ...) (*types.ActionResponse, error)
- type Service
- func (s *Service) LastStorageErr() error
- func (s *Service) ProcessAndStore(ctx context.Context, r *types.ActionResponse) error
- func (s *Service) Serve(ctx context.Context, actionID common.Hash, submissionTag types.SubmissionTag) (*types.ActionResponse, error)
- func (s *Service) SetIdentity(teeID common.Address) error
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
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 ¶
ProcessAndStore stores response into database and triggers appropriate hooks.