storage

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a data container being fetched does not exist.
	ErrNotFound = errors.New("data container not found")

	// ErrAlreadyExists is returned when a new container being added already
	// exists.
	ErrAlreadyExists = errors.New("data container already exists")
)

Functions

This section is empty.

Types

type Record

type Record struct {
	ID                  *user.DataContainerID
	OwnerAccount        string
	IdentifyingFeatures *user.IdentifyingFeatures
	CreatedAt           time.Time
}

DataContainer represents a logical boundary that separates and isolates a copy of a user's data. The owner account acts as the owner of the copy of data as both a form of authentication (via signing of the owner account private key) and authorization (by exact match of an authenticated owner account address linked to a container). The ID must be used as part of the key for user data systems.

func (*Record) Validate

func (r *Record) Validate() error

Validate validates a Record

type Store

type Store interface {
	// Put creates a new data container.
	Put(ctx context.Context, record *Record) error

	// GetByID gets a data container by its ID.
	GetByID(ctx context.Context, id *user.DataContainerID) (*Record, error)

	// GetByFeatures gets a data container that matches the set of features.
	GetByFeatures(ctx context.Context, ownerAccount string, features *user.IdentifyingFeatures) (*Record, error)
}

Store manages copies of a user's data using logical containers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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