Documentation
¶
Index ¶
- type Service
- func (s *Service) Close()
- func (s *Service) GetIdentityUpdates(ctx context.Context, req *identityV1.GetIdentityUpdatesRequest) (*identityV1.GetIdentityUpdatesResponse, error)
- func (s *Service) GetInboxIds(ctx context.Context, req *identityV1.GetInboxIdsRequest) (*identityV1.GetInboxIdsResponse, error)
- func (s *Service) PublishIdentityUpdate(ctx context.Context, req *identityV1.PublishIdentityUpdateRequest) (*identityV1.PublishIdentityUpdateResponse, error)
- func (s *Service) VerifySmartContractWalletSignatures(ctx context.Context, ...) (*identityV1.VerifySmartContractWalletSignaturesResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct { identityV1.UnimplementedIdentityApiServer // contains filtered or unexported fields }
func NewService ¶
func NewService( log *zap.Logger, store mlsstore.ReadWriteMlsStore, validationService mlsvalidate.MLSValidationService, ) (s *Service, err error)
func (*Service) GetIdentityUpdates ¶
func (s *Service) GetIdentityUpdates( ctx context.Context, req *identityV1.GetIdentityUpdatesRequest, ) (*identityV1.GetIdentityUpdatesResponse, error)
func (*Service) GetInboxIds ¶
func (s *Service) GetInboxIds( ctx context.Context, req *identityV1.GetInboxIdsRequest, ) (*identityV1.GetInboxIdsResponse, error)
func (*Service) PublishIdentityUpdate ¶
func (s *Service) PublishIdentityUpdate( ctx context.Context, req *identityV1.PublishIdentityUpdateRequest, ) (*identityV1.PublishIdentityUpdateResponse, error)
Properties we want on the inbox log:
- Updates come in and are assigned sequence numbers in some order
- Updates are not visible to API consumers until they have been validated and the address_log table has been updated
- If you read once, and then read again: a. The second read must have all of the updates from the first read b. New updates from the second read *cannot* have a lower sequence number than the latest sequence number from the first read c. This only applies to reads *on a given inbox*. Ordering between different inboxes does not matter.
For the address log, strict ordering/strong consistency is not required across inboxes. Resolving eventually to any non-revoked inbox_id is acceptable.
Algorithm for PublishIdentityUpdate:
Start transaction (SERIALIZABLE isolation level)
- Read the log for the inbox_id, ordering by sequence_id - Use FOR UPDATE to block other transactions on the same inbox_id
- If the log has 256 or more entries, abort the transaction.
- Concatenate the update in-memory and validate it sequentially. If failed, abort the transaction.
- Insert the update into the inbox_log table
- For each affected address: a. Insert or update the record with (address, inbox_id) into the address_log table, updating the relevant sequence_id (it should always be higher)
End transaction
func (*Service) VerifySmartContractWalletSignatures ¶
func (s *Service) VerifySmartContractWalletSignatures( ctx context.Context, req *identityV1.VerifySmartContractWalletSignaturesRequest, ) (*identityV1.VerifySmartContractWalletSignaturesResponse, error)
Click to show internal directories.
Click to hide internal directories.