inmemory

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Instantiate

func Instantiate() (storage.Storage, error)

Types

type InMemoryIterator

type InMemoryIterator[T any] struct {
	// contains filtered or unexported fields
}

InMemoryIterator provides an iterator over a map[string]*T.

func NewInMemoryIterator

func NewInMemoryIterator[T any](m *map[string]*T) *InMemoryIterator[T]

NewInMemoryIterator constructs an iterator over a map[string]*T. You can pass any map like map[string]*UserAuth, map[string]*Domain, etc.

func NewInMemoryIteratorCustomDecode

func NewInMemoryIteratorCustomDecode[T any](m *map[string]*T, decodeFunc func([]byte, interface{}) error) *InMemoryIterator[T]

NewInMemoryIteratorCustomDecode creates a new LevelDBIterator instance for the given LevelDB iterator and decode function.

func (*InMemoryIterator[T]) Close

func (it *InMemoryIterator[T]) Close()

Close is a no-op for in-memory iterators, present to satisfy common interfaces.

func (*InMemoryIterator[T]) DropItem

func (it *InMemoryIterator[T]) DropItem() error

DropItem deletes the key currently pointed to by the iterator.

func (*InMemoryIterator[T]) Err

func (it *InMemoryIterator[T]) Err() error

Err returns any error encountered during iteration (always nil here).

func (*InMemoryIterator[T]) Item

func (it *InMemoryIterator[T]) Item() *T

Item returns the current item pointed to by the iterator.

func (*InMemoryIterator[T]) Next

func (it *InMemoryIterator[T]) Next() (valid bool)

Next advances the iterator to the next item.

func (*InMemoryIterator[T]) NextWithError

func (it *InMemoryIterator[T]) NextWithError() (valid bool)

NextWithError advances the iterator to the next item.

func (*InMemoryIterator[T]) Raw

func (it *InMemoryIterator[T]) Raw() []byte

Raw returns the raw (non-decoded) value at the current iterator position. Should only be called after a successful call to Next().

type InMemoryStorage

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

InMemoryStorage implements the Storage interface using in-memory data structures.

func NewInMemoryStorage

func NewInMemoryStorage() (*InMemoryStorage, error)

NewInMemoryStorage creates a new instance of InMemoryStorage.

func (*InMemoryStorage) AuthUserExists

func (s *InMemoryStorage) AuthUserExists(email string) (bool, error)

AuthUserExists checks if the given email address is already associated to an User.

func (*InMemoryStorage) ClearAuthUsers

func (s *InMemoryStorage) ClearAuthUsers() error

ClearAuthUsers deletes all AuthUsers present in the database.

func (*InMemoryStorage) ClearDomains

func (s *InMemoryStorage) ClearDomains() error

ClearDomains deletes all Domains present in the database.

func (*InMemoryStorage) ClearProviders

func (s *InMemoryStorage) ClearProviders() error

ClearProviders deletes all Providers present in the database.

func (*InMemoryStorage) ClearSessions

func (s *InMemoryStorage) ClearSessions() error

ClearSessions deletes all Sessions present in the database.

func (*InMemoryStorage) ClearUsers

func (s *InMemoryStorage) ClearUsers() error

ClearUsers deletes all Users present in the database.

func (*InMemoryStorage) ClearZones

func (s *InMemoryStorage) ClearZones() error

ClearZones deletes all Zones present in the database.

func (*InMemoryStorage) Close

func (s *InMemoryStorage) Close() error

Close shutdown the connection with the database and releases all structure.

func (*InMemoryStorage) CreateAuthUser

func (s *InMemoryStorage) CreateAuthUser(user *happydns.UserAuth) (err error)

CreateAuthUser creates a record in the database for the given User.

func (*InMemoryStorage) CreateDomain

func (s *InMemoryStorage) CreateDomain(domain *happydns.Domain) (err error)

CreateDomain creates a record in the database for the given Domain.

func (*InMemoryStorage) CreateDomainLog

func (s *InMemoryStorage) CreateDomainLog(domain *happydns.Domain, log *happydns.DomainLog) (err error)

CreateDomainLog creates a log entry for the given Domain.

func (*InMemoryStorage) CreateOrUpdateUser

func (s *InMemoryStorage) CreateOrUpdateUser(user *happydns.User) error

CreateOrUpdateUser updates the fields of the given User.

func (*InMemoryStorage) CreateProvider

func (s *InMemoryStorage) CreateProvider(p *happydns.Provider) error

CreateProvider creates a record in the database for the given Provider.

func (*InMemoryStorage) CreateZone

func (s *InMemoryStorage) CreateZone(zone *happydns.Zone) (err error)

CreateZone creates a record in the database for the given Zone.

func (*InMemoryStorage) DeleteAuthUser

func (s *InMemoryStorage) DeleteAuthUser(user *happydns.UserAuth) error

DeleteAuthUser removes the given User from the database.

func (*InMemoryStorage) DeleteDomain

func (s *InMemoryStorage) DeleteDomain(domainid happydns.Identifier) error

DeleteDomain removes the given Domain from the database.

func (*InMemoryStorage) DeleteDomainLog

func (s *InMemoryStorage) DeleteDomainLog(domain *happydns.Domain, log *happydns.DomainLog) error

DeleteDomainLog deletes a log entry for the given Domain.

func (*InMemoryStorage) DeleteProvider

func (s *InMemoryStorage) DeleteProvider(id happydns.Identifier) error

DeleteProvider removes the given Provider from the database.

func (*InMemoryStorage) DeleteSession

func (s *InMemoryStorage) DeleteSession(id string) error

DeleteSession removes the given Session from the database.

func (*InMemoryStorage) DeleteUser

func (s *InMemoryStorage) DeleteUser(userid happydns.Identifier) error

DeleteUser removes the given User from the database.

func (*InMemoryStorage) DeleteZone

func (s *InMemoryStorage) DeleteZone(id happydns.Identifier) error

DeleteZone removes the given Zone from the database.

func (*InMemoryStorage) GetAuthUser

func (s *InMemoryStorage) GetAuthUser(id happydns.Identifier) (*happydns.UserAuth, error)

GetAuthUser retrieves the User with the given identifier.

func (*InMemoryStorage) GetAuthUserByEmail

func (s *InMemoryStorage) GetAuthUserByEmail(email string) (*happydns.UserAuth, error)

GetAuthUserByEmail retrieves the User with the given email address.

func (*InMemoryStorage) GetDomain

func (s *InMemoryStorage) GetDomain(id happydns.Identifier) (*happydns.Domain, error)

GetDomain retrieves the Domain with the given id and owned by the given User.

func (*InMemoryStorage) GetDomainByDN

func (s *InMemoryStorage) GetDomainByDN(u *happydns.User, dn string) (ret []*happydns.Domain, err error)

GetDomainByDN is like GetDomain but look for the domain name instead of identifier.

func (*InMemoryStorage) GetProvider

func (s *InMemoryStorage) GetProvider(id happydns.Identifier) (*happydns.ProviderMessage, error)

GetProvider retrieves the full Provider with the given identifier and owner.

func (*InMemoryStorage) GetSession

func (s *InMemoryStorage) GetSession(id string) (*happydns.Session, error)

GetSession retrieves the Session with the given identifier.

func (*InMemoryStorage) GetUser

func (s *InMemoryStorage) GetUser(id happydns.Identifier) (*happydns.User, error)

GetUser retrieves the User with the given identifier.

func (*InMemoryStorage) GetUserByEmail

func (s *InMemoryStorage) GetUserByEmail(email string) (*happydns.User, error)

GetUserByEmail retrieves the User with the given email address.

func (*InMemoryStorage) GetZone

func (s *InMemoryStorage) GetZone(id happydns.Identifier) (*happydns.ZoneMessage, error)

GetZone retrieves the full Zone (including Services and metadata) which have the given identifier.

func (*InMemoryStorage) GetZoneMeta

func (s *InMemoryStorage) GetZoneMeta(id happydns.Identifier) (*happydns.ZoneMeta, error)

GetZoneMeta retrieves metadata of the Zone with the given identifier.

func (*InMemoryStorage) InsightsRun

func (s *InMemoryStorage) InsightsRun() error

InsightsRun registers a insights process run just now.

func (*InMemoryStorage) LastInsightsRun

func (s *InMemoryStorage) LastInsightsRun() (*time.Time, happydns.Identifier, error)

LastInsightsRun gets the last time insights process run.

func (*InMemoryStorage) ListAllAuthUsers

func (s *InMemoryStorage) ListAllAuthUsers() (happydns.Iterator[happydns.UserAuth], error)

func (*InMemoryStorage) ListAllDomainLogs

func (s *InMemoryStorage) ListAllDomainLogs() (happydns.Iterator[happydns.DomainLogWithDomainId], error)

func (*InMemoryStorage) ListAllDomains

func (s *InMemoryStorage) ListAllDomains() (happydns.Iterator[happydns.Domain], error)

func (*InMemoryStorage) ListAllProviders

func (s *InMemoryStorage) ListAllProviders() (happydns.Iterator[happydns.ProviderMessage], error)

func (*InMemoryStorage) ListAllSessions

func (s *InMemoryStorage) ListAllSessions() (happydns.Iterator[happydns.Session], error)

func (*InMemoryStorage) ListAllUsers

func (s *InMemoryStorage) ListAllUsers() (happydns.Iterator[happydns.User], error)

func (*InMemoryStorage) ListAllZones

func (s *InMemoryStorage) ListAllZones() (happydns.Iterator[happydns.ZoneMessage], error)

func (*InMemoryStorage) ListAuthUserSessions

func (s *InMemoryStorage) ListAuthUserSessions(user *happydns.UserAuth) (sessions []*happydns.Session, ess error)

ListAuthUserSessions retrieves all Session for the given AuthUser.

func (*InMemoryStorage) ListAuthUsers

func (s *InMemoryStorage) ListAuthUsers() (happydns.UserAuths, error)

ListAuthUsers retrieves the list of known Users.

func (*InMemoryStorage) ListDomainLogs

func (s *InMemoryStorage) ListDomainLogs(domain *happydns.Domain) (dlogs []*happydns.DomainLog, err error)

ListDomainLogs retrieves the logs for the given Domain.

func (*InMemoryStorage) ListDomains

func (s *InMemoryStorage) ListDomains(u *happydns.User) ([]*happydns.Domain, error)

ListDomains retrieves all Domains associated to the given User.

func (*InMemoryStorage) ListProviders

func (s *InMemoryStorage) ListProviders(u *happydns.User) (happydns.ProviderMessages, error)

ListProviders retrieves all providers owned by the given User.

func (*InMemoryStorage) ListUserSessions

func (s *InMemoryStorage) ListUserSessions(userid happydns.Identifier) (sessions []*happydns.Session, ess error)

ListUserSessions retrieves all Session for the given User.

func (*InMemoryStorage) ListUsers

func (s *InMemoryStorage) ListUsers() (users []*happydns.User, err error)

ListUsers retrieves the list of known Users.

func (*InMemoryStorage) MigrateSchema

func (s *InMemoryStorage) MigrateSchema() error

DoMigration is the first function called.

func (*InMemoryStorage) SchemaVersion

func (s *InMemoryStorage) SchemaVersion() int

SchemaVersion returns the version of the migration currently in use.

func (*InMemoryStorage) Tidy

func (s *InMemoryStorage) Tidy() error

Tidy should optimize the database, looking for orphan records, ...

func (*InMemoryStorage) UpdateAuthUser

func (s *InMemoryStorage) UpdateAuthUser(user *happydns.UserAuth) error

UpdateAuthUser updates the fields of the given User.

func (*InMemoryStorage) UpdateDomain

func (s *InMemoryStorage) UpdateDomain(domain *happydns.Domain) error

UpdateDomain updates the fields of the given Domain.

func (*InMemoryStorage) UpdateDomainLog

func (s *InMemoryStorage) UpdateDomainLog(domain *happydns.Domain, log *happydns.DomainLog) error

UpdateDomainLog updates a log entry for the given Domain.

func (*InMemoryStorage) UpdateProvider

func (s *InMemoryStorage) UpdateProvider(p *happydns.Provider) error

UpdateProvider updates the fields of the given Provider.

func (*InMemoryStorage) UpdateSession

func (s *InMemoryStorage) UpdateSession(session *happydns.Session) error

UpdateSession updates the fields of the given Session.

func (*InMemoryStorage) UpdateZone

func (s *InMemoryStorage) UpdateZone(zone *happydns.Zone) error

UpdateZone updates the fields of the given Zone.

Source Files

  • auth_user.go
  • config.go
  • database.go
  • domain.go
  • insight.go
  • iterator.go
  • provider.go
  • session.go
  • user.go
  • zone.go

Jump to

Keyboard shortcuts

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