kvstore

package
v0.0.4-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New[E any](
	logger *logging.Logger,
	dao datastore.GenericDAO[E]) datastore.GenericDAO[E]

func NewFactory

func NewFactory(params *Params) (datastore.Factory, error)

func NewOrganizationDAO

func NewOrganizationDAO(params *Params) (datastore.OrganizationDAO, error)

func NewRegistrationDAO

func NewRegistrationDAO(params *Params) (datastore.RegistrationDAO, error)

func NewRoleDAO

func NewRoleDAO(params *Params) (datastore.RoleDAO, error)

func NewUserDAO

func NewUserDAO(params *Params) (datastore.UserDAO, error)

func NewWebAuthnDAO

func NewWebAuthnDAO(params *Params) (datastore.WebAuthnDAO, error)

Types

type AferoDAO

type AferoDAO[E any] struct {
	datastore.GenericDAO[E]
	// contains filtered or unexported fields
}

func NewAferoDAO

func NewAferoDAO[E any](params *Params) (*AferoDAO[E], error)

Creates a key/value blob storage backend

func (*AferoDAO[E]) Count

func (aferoDAO *AferoDAO[E]) Count(CONSISTENCY_LEVEL int) (int, error)

Returns the number of items in the blob store partition using a buffered read

func (*AferoDAO[E]) Delete

func (aferoDAO *AferoDAO[E]) Delete(entity E) error

Deletes the provided entity from the blob datastore. Returns an error if the provided entity can't be found.

func (*AferoDAO[E]) ForEachPage

func (aferoDAO *AferoDAO[E]) ForEachPage(
	pageQuery datastore.PageQuery,
	pagerProcFunc datastore.PagerProcFunc[E],
	CONSISTENCY_LEVEL int) error

Reads all records in batches of PageQuery.PageSize, passing each page to the provided pageProcFunc to process the resultset.

func (*AferoDAO[E]) Get

func (aferoDAO *AferoDAO[E]) Get(id uint64, CONSISTENCY_LEVEL int) (E, error)

Retrieves the entity with the provided ID from the blob datastore. Returns an error if the entity can't be found or if it can't be unmarshalled.

func (*AferoDAO[E]) Page

func (aferoDAO *AferoDAO[E]) Page(
	pageQuery datastore.PageQuery,
	CONSISTENCY_LEVEL int) (datastore.PageResult[E], error)

Returns a page of items in the blob store partition

func (*AferoDAO[E]) Save

func (aferoDAO *AferoDAO[E]) Save(entity E) error

Saves the provided entity to the blob datastore. Returns an error if the entity can not be serialized or there is a problem saving to blob storage.

type Factory

type Factory struct {
	datastore.Factory
	// contains filtered or unexported fields
}

func (*Factory) OrganizationDAO

func (factory *Factory) OrganizationDAO() (datastore.OrganizationDAO, error)

func (*Factory) RegistrationDAO

func (factory *Factory) RegistrationDAO() (datastore.RegistrationDAO, error)

func (*Factory) RoleDAO

func (factory *Factory) RoleDAO() (datastore.RoleDAO, error)

func (*Factory) UserDAO

func (factory *Factory) UserDAO() (datastore.UserDAO, error)

func (*Factory) WebAuthnDAO

func (factory *Factory) WebAuthnDAO() (datastore.WebAuthnDAO, error)

type KVStore

type KVStore[E any] struct {
	datastore.GenericDAO[E]
	// contains filtered or unexported fields
}

func (*KVStore[E]) Count

func (kvstore *KVStore[E]) Count(CONSISTENCY_LEVEL int) (int, error)

func (*KVStore[E]) Delete

func (kvstore *KVStore[E]) Delete(entity E) error

func (*KVStore[E]) ForEachPage

func (kvstore *KVStore[E]) ForEachPage(
	pageQuery datastore.PageQuery,
	pagerProcFunc datastore.PagerProcFunc[E],
	CONSISTENCY_LEVEL int) error

func (*KVStore[E]) Get

func (kvstore *KVStore[E]) Get(id uint64, CONSISTENCY_LEVEL int) (E, error)

func (*KVStore[E]) Page

func (kvstore *KVStore[E]) Page(
	pageQuery datastore.PageQuery,
	CONSISTENCY_LEVEL int) (datastore.PageResult[E], error)

func (*KVStore[E]) Save

func (kvstore *KVStore[E]) Save(entity E) error

type OrganizationDAO

type OrganizationDAO struct {
	*AferoDAO[*entities.Organization]
}

func (*OrganizationDAO) Count

func (organizationDAO *OrganizationDAO) Count(CONSISTENCY_LEVEL int) (int, error)

func (*OrganizationDAO) Delete

func (organizationDAO *OrganizationDAO) Delete(entity *entities.Organization) error

func (*OrganizationDAO) ForEachPage

func (organizationDAO *OrganizationDAO) ForEachPage(
	pageQuery datastore.PageQuery,
	pagerProcFunc datastore.PagerProcFunc[*entities.Organization],
	CONSISTENCY_LEVEL int) error

func (*OrganizationDAO) Get

func (organizationDAO *OrganizationDAO) Get(id uint64, CONSISTENCY_LEVEL int) (*entities.Organization, error)

func (*OrganizationDAO) GetUsers

func (organizationDAO *OrganizationDAO) GetUsers(id uint64, CONSISTENCY_LEVEL int) ([]*entities.User, error)

func (*OrganizationDAO) Page

func (organizationDAO *OrganizationDAO) Page(
	pageQuery datastore.PageQuery,
	CONSISTENCY_LEVEL int) (datastore.PageResult[*entities.Organization], error)

func (*OrganizationDAO) Save

func (organizationDAO *OrganizationDAO) Save(entity *entities.Organization) error

type Params

type Params struct {
	Fs             afero.Fs
	Logger         *logging.Logger
	Partition      string
	ReadBufferSize int
	RootDir        string
	Serializer     datastore.Serializer
}

type RegistrationDAO

type RegistrationDAO struct {
	*AferoDAO[*entities.Registration]
}

func (*RegistrationDAO) Count

func (registrationDAO *RegistrationDAO) Count(CONSISTENCY_LEVEL int) (int, error)

func (*RegistrationDAO) Delete

func (registrationDAO *RegistrationDAO) Delete(entity *entities.Registration) error

func (*RegistrationDAO) ForEachPage

func (registrationDAO *RegistrationDAO) ForEachPage(
	pageQuery datastore.PageQuery,
	pagerProcFunc datastore.PagerProcFunc[*entities.Registration],
	CONSISTENCY_LEVEL int) error

func (*RegistrationDAO) Get

func (registrationDAO *RegistrationDAO) Get(id uint64, CONSISTENCY_LEVEL int) (*entities.Registration, error)

func (*RegistrationDAO) Page

func (registrationDAO *RegistrationDAO) Page(
	pageQuery datastore.PageQuery,
	CONSISTENCY_LEVEL int) (datastore.PageResult[*entities.Registration], error)

func (*RegistrationDAO) Save

func (registrationDAO *RegistrationDAO) Save(entity *entities.Registration) error

type RoleDAO

type RoleDAO struct {
	*AferoDAO[*entities.Role]
}

func (*RoleDAO) Count

func (roleDAO *RoleDAO) Count(CONSISTENCY_LEVEL int) (int, error)

func (*RoleDAO) Delete

func (roleDAO *RoleDAO) Delete(entity *entities.Role) error

func (*RoleDAO) ForEachPage

func (roleDAO *RoleDAO) ForEachPage(
	pageQuery datastore.PageQuery,
	pagerProcFunc datastore.PagerProcFunc[*entities.Role],
	CONSISTENCY_LEVEL int) error

func (*RoleDAO) Get

func (roleDAO *RoleDAO) Get(id uint64, CONSISTENCY_LEVEL int) (*entities.Role, error)

func (*RoleDAO) GetByName

func (roleDAO *RoleDAO) GetByName(name string, CONSISTENCY_LEVEL int) (*entities.Role, error)

func (*RoleDAO) Page

func (roleDAO *RoleDAO) Page(
	pageQuery datastore.PageQuery,
	CONSISTENCY_LEVEL int) (datastore.PageResult[*entities.Role], error)

func (*RoleDAO) Save

func (roleDAO *RoleDAO) Save(entity *entities.Role) error

type UserDAO

type UserDAO struct {
	*AferoDAO[*entities.User]
}

func (*UserDAO) Count

func (userDAO *UserDAO) Count(CONSISTENCY_LEVEL int) (int, error)

func (*UserDAO) Delete

func (userDAO *UserDAO) Delete(entity *entities.User) error

func (*UserDAO) ForEachPage

func (userDAO *UserDAO) ForEachPage(
	pageQuery datastore.PageQuery,
	pagerProcFunc datastore.PagerProcFunc[*entities.User],
	CONSISTENCY_LEVEL int) error

func (*UserDAO) Get

func (userDAO *UserDAO) Get(id uint64, CONSISTENCY_LEVEL int) (*entities.User, error)

func (*UserDAO) Page

func (userDAO *UserDAO) Page(
	pageQuery datastore.PageQuery,
	CONSISTENCY_LEVEL int) (datastore.PageResult[*entities.User], error)

func (*UserDAO) Save

func (userDAO *UserDAO) Save(entity *entities.User) error

type WebAuthnDAO

type WebAuthnDAO struct {
	*AferoDAO[*entities.Blob]
}

func (*WebAuthnDAO) Count

func (webauthnDAO *WebAuthnDAO) Count(CONSISTENCY_LEVEL int) (int, error)

func (*WebAuthnDAO) Delete

func (webauthnDAO *WebAuthnDAO) Delete(entity *entities.Blob) error

func (*WebAuthnDAO) ForEachPage

func (webauthnDAO *WebAuthnDAO) ForEachPage(
	pageQuery datastore.PageQuery,
	pagerProcFunc datastore.PagerProcFunc[*entities.Blob],
	CONSISTENCY_LEVEL int) error

func (*WebAuthnDAO) Get

func (webauthnDAO *WebAuthnDAO) Get(id uint64, CONSISTENCY_LEVEL int) (*entities.Blob, error)

func (*WebAuthnDAO) Page

func (webauthnDAO *WebAuthnDAO) Page(
	pageQuery datastore.PageQuery,
	CONSISTENCY_LEVEL int) (datastore.PageResult[*entities.Blob], error)

func (*WebAuthnDAO) Save

func (webauthnDAO *WebAuthnDAO) Save(entity *entities.Blob) error

Jump to

Keyboard shortcuts

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