mongo

package
v0.0.0-...-0174093 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resource

type Resource struct {
	ID        string    `bson:"_id"`
	Data      []byte    `bson:"data"`
	Status    string    `bson:"status"`
	Version   *string   `bson:"version"`
	UpdatedAt time.Time `bson:"updated_at"`
}

type Storage

type Storage struct {
	Collection  *mongo.Collection
	LockTimeout time.Duration
}

func (*Storage) Alloc

func (storage *Storage) Alloc(ctx context.Context, amount int) ([]resource.ID, error)

func (*Storage) Dealloc

func (storage *Storage) Dealloc(ctx context.Context, ids []resource.ID) error

func (*Storage) Init

func (storage *Storage) Init(ctx context.Context, resources []resource.Resource) error

func (*Storage) Load

func (storage *Storage) Load(ctx context.Context, ids ...resource.ID) ([]resource.Resource, error)

Jump to

Keyboard shortcuts

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