Documentation
¶
Index ¶
- func AsnPoolRange(min, max uint) dataStoreOption
- func Initialize(ctx context.Context, log *slog.Logger, opts r.ConnectOpts, ...) error
- func Migrate(ctx context.Context, opts r.ConnectOpts, log *slog.Logger, targetVersion *int, ...) error
- func MustRegisterMigration(m Migration)
- func New(log *slog.Logger, opts r.ConnectOpts, dsOpts ...dataStoreOption) (*datastore, error)
- func VrfPoolRange(min, max uint) dataStoreOption
- type Datastore
- type Entity
- type EntityQuery
- type Migration
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsnPoolRange ¶ added in v0.0.2
func AsnPoolRange(min, max uint) dataStoreOption
func Initialize ¶
func Migrate ¶
func Migrate(ctx context.Context, opts r.ConnectOpts, log *slog.Logger, targetVersion *int, dry bool) error
Migrate runs database migrations and puts the database into read only mode for demoted runtime users.
func MustRegisterMigration ¶
func MustRegisterMigration(m Migration)
MustRegisterMigration registers a migration and panics when a problem occurs
func New ¶
func New(log *slog.Logger, opts r.ConnectOpts, dsOpts ...dataStoreOption) (*datastore, error)
func VrfPoolRange ¶ added in v0.0.2
func VrfPoolRange(min, max uint) dataStoreOption
Types ¶
type Datastore ¶
type Datastore interface {
IP() Storage[*metal.IP]
Machine() Storage[*metal.Machine]
Size() Storage[*metal.Size]
SizeReservation() Storage[*metal.SizeReservation]
Partition() Storage[*metal.Partition]
Network() Storage[*metal.Network]
FilesystemLayout() Storage[*metal.FilesystemLayout]
Image() Storage[*metal.Image]
Switch() Storage[*metal.Switch]
SwitchStatus() Storage[*metal.SwitchStatus]
Event() Storage[*metal.ProvisioningEventContainer]
// Pools
AsnPool() *integerPool
VrfPool() *integerPool
Version(ctx context.Context) (string, error)
}
type Entity ¶
type Entity interface {
// GetID returns the entity's id
GetID() string
// SetID sets the entity's id
SetID(id string)
// GetChanged returns the entity's changed time
GetChanged() time.Time
// GetCreated returns the entity's creation time
GetCreated() time.Time
// GetGeneration returns the entity's generation
GetGeneration() uint64
}
Entity is an interface that allows metal entities to be created and stored into the database with the generic creation and update functions.
type Storage ¶
type Storage[E Entity] interface { Create(ctx context.Context, e E) (E, error) Update(ctx context.Context, e E) error Upsert(ctx context.Context, e E) error Delete(ctx context.Context, e E) error Get(ctx context.Context, id string) (E, error) Find(ctx context.Context, queries ...EntityQuery) (E, error) List(ctx context.Context, queries ...EntityQuery) ([]E, error) }
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package migrations contains migration functions for migrating the RethinkDB.
|
Package migrations contains migration functions for migrating the RethinkDB. |
Click to show internal directories.
Click to hide internal directories.