storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const UserCacheSize = 10_000

Variables

This section is empty.

Functions

func NewMetricsStorage added in v1.0.0

func NewMetricsStorage(dbType, dbConnectionURL string) (*cosmosdb.MetricsStorageCosmosDB, error)

NewMetricsStorage is a factory function to create a MetricsStorage instance

Types

type CertStorage added in v1.0.0

type CertStorage interface {
	autocert.Cache
}

CertStorage defines the interface for certificate storage

func NewCertStorage added in v1.0.0

func NewCertStorage(dbType, dbConnectionURL string, randomKey []byte, encryptionEnabled bool, logger gethlog.Logger) (CertStorage, error)

NewCertStorage creates a new certificate storage instance based on the database type

type UserStorage added in v0.28.0

type UserStorage interface {
	AddUser(userID []byte, privateKey []byte) error
	DeleteUser(userID []byte) error
	AddAccount(userID []byte, accountAddress []byte, signature []byte, signatureType viewingkey.SignatureType) error
	AddSessionKey(userID []byte, key common.GWSessionKey) error
	ActivateSessionKey(userID []byte, active bool) error
	RemoveSessionKey(userID []byte) error
	GetUser(userID []byte) (*common.GWUser, error)
	GetEncryptionKey() []byte
}

todo - pass the Context

func New

func New(dbType, dbConnectionURL, dbPath string, randomKey []byte, logger gethlog.Logger) (UserStorage, error)

type UserStorageWithCache added in v0.28.0

type UserStorageWithCache struct {
	// contains filtered or unexported fields
}

UserStorageWithCache implements the UserStorage interface with caching

func NewUserStorageWithCache added in v0.28.0

func NewUserStorageWithCache(storage UserStorage, logger log.Logger) (*UserStorageWithCache, error)

NewUserStorageWithCache creates a new UserStorageWithCache instance

func (*UserStorageWithCache) ActivateSessionKey added in v1.0.0

func (s *UserStorageWithCache) ActivateSessionKey(userID []byte, active bool) error

func (*UserStorageWithCache) AddAccount added in v0.28.0

func (s *UserStorageWithCache) AddAccount(userID []byte, accountAddress []byte, signature []byte, signatureType viewingkey.SignatureType) error

AddAccount adds an account to a user and invalidates the cache for the userID

func (*UserStorageWithCache) AddSessionKey added in v1.0.0

func (s *UserStorageWithCache) AddSessionKey(userID []byte, key wecommon.GWSessionKey) error

func (*UserStorageWithCache) AddUser added in v0.28.0

func (s *UserStorageWithCache) AddUser(userID []byte, privateKey []byte) error

AddUser adds a new user and invalidates the cache for the userID

func (*UserStorageWithCache) DeleteUser added in v0.28.0

func (s *UserStorageWithCache) DeleteUser(userID []byte) error

DeleteUser deletes a user and invalidates the cache for the userID

func (*UserStorageWithCache) GetEncryptionKey added in v1.0.0

func (s *UserStorageWithCache) GetEncryptionKey() []byte

GetEncryptionKey delegates to the underlying storage

func (*UserStorageWithCache) GetUser added in v0.28.0

func (s *UserStorageWithCache) GetUser(userID []byte) (*wecommon.GWUser, error)

GetUser retrieves a user from the cache or underlying storage

func (*UserStorageWithCache) RemoveSessionKey added in v1.0.0

func (s *UserStorageWithCache) RemoveSessionKey(userID []byte) error

Directories

Path Synopsis
database

Jump to

Keyboard shortcuts

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