crate

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BottleBucket = "bottles"

Variables

This section is empty.

Functions

func BottleToPB

func BottleToPB(bottle *bottle.Bottle) *pb.Bottle

func NewCrateService

func NewCrateService(store BottleStore) *crateService

func NewGRPCServer

func NewGRPCServer(endpoints Endpoints, logger log.Logger) pb.CrateServer

NewGRPCServer makes a of endpoints available as a gRPC Crate Server

func PBToBottle

func PBToBottle(b *pb.Bottle) *bottle.Bottle

Types

type BoltBottleStore

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

BoltBottleStore is a BoltDB backed bottle store

func NewBoltBottleStore

func NewBoltBottleStore(file string) (s *BoltBottleStore, err error)

NewBoltBottleStore returns a boltDB backed bottle store

func (*BoltBottleStore) Delete

func (s *BoltBottleStore) Delete(id string) error

func (*BoltBottleStore) Get

func (s *BoltBottleStore) Get(id string) (*bottle.Bottle, error)

func (*BoltBottleStore) List

func (s *BoltBottleStore) List() ([]*bottle.Bottle, error)

func (*BoltBottleStore) Put

func (s *BoltBottleStore) Put(b *bottle.Bottle) error

type BottleStore

type BottleStore interface {
	Get(id string) (b *bottle.Bottle, err error)
	Put(b *bottle.Bottle) error
	Delete(id string) error
	List() (bb []*bottle.Bottle, err error)
}

Store is an interface for a bottle database

type CrateService

type CrateService interface {
	StoreBottle(*bottle.Bottle) error
	PourBottle(id string) (*bottle.Bottle, error)
	DrainBottle(id string) (*bottle.Bottle, error)
	ListBottles() ([]string, error)
}

type Endpoints

type Endpoints struct {
	Store endpoint.Endpoint
	Drain endpoint.Endpoint
	Pour  endpoint.Endpoint
	List  endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(svc CrateService) Endpoints

type LoggingMiddleware

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

func NewLoggingMiddleware

func NewLoggingMiddleware(logger log.Logger, next CrateService) *LoggingMiddleware

func (*LoggingMiddleware) DrainBottle

func (mw *LoggingMiddleware) DrainBottle(id string) (b *bottle.Bottle, err error)

func (*LoggingMiddleware) ListBottles

func (mw *LoggingMiddleware) ListBottles() (bb []string, err error)

func (*LoggingMiddleware) PourBottle

func (mw *LoggingMiddleware) PourBottle(id string) (b *bottle.Bottle, err error)

func (*LoggingMiddleware) StoreBottle

func (mw *LoggingMiddleware) StoreBottle(b *bottle.Bottle) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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