dsmongo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DSMongo

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

func NewDSMongo

func NewDSMongo(opts Options) (*DSMongo, error)

func (*DSMongo) Close

func (dsm *DSMongo) Close() error

func (*DSMongo) Delete

func (dsm *DSMongo) Delete(ctx context.Context, id string) error

func (*DSMongo) Get

func (dsm *DSMongo) Get(ctx context.Context, id string) ([]byte, error)

func (*DSMongo) GetSize

func (dsm *DSMongo) GetSize(ctx context.Context, id string) (int64, error)

func (*DSMongo) Has

func (dsm *DSMongo) Has(ctx context.Context, id string) (bool, error)

func (*DSMongo) Put

func (dsm *DSMongo) Put(ctx context.Context, item *StoreItem, ref *RefItem) error

func (*DSMongo) Query

func (dsm *DSMongo) Query(ctx context.Context, q dsq.Query) (chan *dsq.Entry, error)

type MongoStore

type MongoStore struct {
	dsrpc.UnimplementedKVStoreServer
	// contains filtered or unexported fields
}

func NewMongoStore

func NewMongoStore(opts Options) (*MongoStore, error)

func (*MongoStore) Close

func (ms *MongoStore) Close(context.Context) error

func (*MongoStore) Delete

func (ms *MongoStore) Delete(ctx context.Context, req *dsrpc.CommonRequest) (*dsrpc.CommonReply, error)

func (*MongoStore) Get

func (*MongoStore) GetSize

func (ms *MongoStore) GetSize(ctx context.Context, req *dsrpc.CommonRequest) (*dsrpc.CommonReply, error)

func (*MongoStore) Has

func (*MongoStore) Put

func (*MongoStore) Query

type MongoStoreClient

type MongoStoreClient struct {
	dsrpc.KVStoreClient
	// contains filtered or unexported fields
}

func NewMongoStoreClient

func NewMongoStoreClient(srv string) (*MongoStoreClient, error)

func (*MongoStoreClient) Close

func (ms *MongoStoreClient) Close() error

type Options

type Options struct {
	Uri           string
	DBName        string
	StoreName     string
	StoreRefsName string
}

func DefaultOptions

func DefaultOptions() Options

type RefItem

type RefItem struct {
	ID        string    `bson:"_id" json:"_id"` // key
	Ref       string    `bson:"ref" json:"ref"` // value
	Size      int64     `bson:"size" json:"size"`
	NID       []string  `bson:"nid" json:"nid"`
	CreatedAt time.Time `bson:"created_at" json:"created_at"`
}

type StoreItem

type StoreItem struct {
	ID        string    `bson:"_id" json:"_id"`             // sha256 hash
	Value     []byte    `bson:"value" json:"value"`         // value
	RefCount  int       `bson:"ref_count" json:"ref_count"` // deprecated
	CreatedAt time.Time `bson:"created_at" json:"created_at"`
}

Jump to

Keyboard shortcuts

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