Documentation
¶
Index ¶
- type ResultStorage
- func (rs *ResultStorage) GetResponse(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
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.
func NewStorage ¶
func NewStorage(s storage.Storage[*types.ActionResponse], n storage.Notifier) *ResultStorage
NewStorage creates a new ResultStorage backed by the provided Storage. The Notifier is used for pub/sub notifications when results are stored.
func (*ResultStorage) GetResponse ¶
func (rs *ResultStorage) GetResponse(ctx context.Context, actionID common.Hash, submissionTag types.SubmissionTag) (*types.ActionResponse, error)
GetResponse 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 with identifier actionID:submissionTag for 2 weeks for end and threshold actions, or half an hour for submit actions.
func (*ResultStorage) WaitOnResponse ¶
func (rs *ResultStorage) WaitOnResponse(ctx context.Context, actionID common.Hash, submissionTag types.SubmissionTag, timeout time.Duration) (*types.ActionResponse, error)
WaitOnResponse waits on the response for the actionID with submissionTag until timeout runs out.
If timeout is not positive, it waits until the response arrives. Should only be used if an action with the given ID and submission tag is expected to be processed.
type Service ¶
type Service struct {
// A channel for wallet update actions (KEY_GENERATE, KEY_DATA_PROVIDER_RESTORE, KEY_DELETE)
WalletSync 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) *Service
NewService creates a new result service.
func (*Service) ProcessAndStore ¶
ProcessAndStore stores response into database and triggers appropriate hooks.