mongo

package
v0.0.0-...-9a1563a Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(cfg *Config) (*common.Database, error)

Types

type Config

type Config struct {
	URI    string `yaml:"uri"`
	DBName string `yaml:"db_name"`

	ConfigTable string `yaml:"config_table"`
	IDTable     string `yaml:"id_table"`
	DiskTable   string `yaml:"disk_table"`
	StripeTable string `yaml:"stripe_table"`
}

type ConfigTable

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

func OpenConfigTable

func OpenConfigTable(tbl *mongo.Collection) (*ConfigTable, error)

func (ConfigTable) ClusterID

func (t ConfigTable) ClusterID(ctx context.Context) (string, error)

type DiskTable

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

func OpenDiskTable

func OpenDiskTable(tbl *mongo.Collection) (*DiskTable, error)

func (*DiskTable) AllocDisks

func (t *DiskTable) AllocDisks(ctx context.Context, mode proto.Mode, args *master.AllocDisksArgs) ([]uint32, error)

func (*DiskTable) Get

func (t *DiskTable) Get(ctx context.Context, diskID uint32) (*proto.Disk, error)

func (*DiskTable) Insert

func (t *DiskTable) Insert(ctx context.Context, disk *proto.Disk) error

func (*DiskTable) List

func (t *DiskTable) List(ctx context.Context, args *master.ListDisksArgs) ([]*proto.Disk, error)

type IDTable

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

func OpenIDTable

func OpenIDTable(tbl *mongo.Collection) (*IDTable, error)

func (IDTable) AllocDiskID

func (t IDTable) AllocDiskID(ctx context.Context) (uint32, error)

func (IDTable) AllocStripeID

func (t IDTable) AllocStripeID(ctx context.Context, count int) ([]uint64, error)

type StripeTable

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

func OpenStripeTable

func OpenStripeTable(tbl *mongo.Collection) (*StripeTable, error)

func (*StripeTable) Insert

func (t *StripeTable) Insert(ctx context.Context, stripes []*proto.Stripe) error

Jump to

Keyboard shortcuts

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