api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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) Close

func (s *Service) Close()

func (*Service) GetInboxIds

func (*Service) PublishIdentityUpdate

Properties we want on the inbox log:

  1. Updates come in and are assigned sequence numbers in some order
  2. Updates are not visible to API consumers until they have been validated and the address_log table has been updated
  3. 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)

  1. Read the log for the inbox_id, ordering by sequence_id - Use FOR UPDATE to block other transactions on the same inbox_id
  2. If the log has 256 or more entries, abort the transaction.
  3. Concatenate the update in-memory and validate it sequentially. If failed, abort the transaction.
  4. Insert the update into the inbox_log table
  5. 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

Jump to

Keyboard shortcuts

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