inventory

package
v0.0.0-...-4515e61 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2019 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeAddItemEndpoint

func MakeAddItemEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeAddItemEndpoint creates a http endpoint to add an item to an inventory object

func MakeCreateEndpoint

func MakeCreateEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeCreateEndpoint creates a http endpoint to create an inventory object

func MakeDeleteEndpoint

func MakeDeleteEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeDeleteEndpoint creates a http endpoint to delete an inventory object

func MakeGetEndpoint

func MakeGetEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeGetEndpoint creates a http endpoint to retrieve an inventory object

func MakeRemoveItemEndpoint

func MakeRemoveItemEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeRemoveItemEndpoint creates a http endpoint to remove an item from an inventory object

func NewGRPCServer

func NewGRPCServer(m Manager) pb.ManagerServer

NewGRPCServer creates a new grpc server instance

Types

type Complete

type Complete interface {
	Identifier
	Incomplete
}

Complete inventory object

type Identifier

type Identifier interface {
	GUID() string
}

Identifier of an inventory

type Incomplete

type Incomplete interface {
	Provider
}

Incomplete inventory object

func NewIncomplete

func NewIncomplete(items []*Item) Incomplete

NewIncomplete returns a new incomplete inventory object instance

type Item

type Item struct {
	ID     string  `json:"id"`
	Amount uint64  `json:"amount"`
	Subset float64 `json:"subset"`
}

Item of an inventory

type Manager

Manager is a manager for inventory objects

func NewGRPCClient

func NewGRPCClient(c *grpc.ClientConn) Manager

NewGRPCClient creates a new inventory manager with a grpc conn

func NewManager

func NewManager(r Repository) Manager

NewManager creates a new manager for managing inventory objects

type Provider

type Provider interface {
	Data() *data
}

Provider of inventory information

type Repository

type Repository interface {
	Get(context.Context, Identifier) (Complete, error)
	Create(context.Context) (Complete, error)
	AddItem(context.Context, Identifier, *Item) error
	RemoveItem(context.Context, Identifier, *Item) error
	Delete(context.Context, Identifier) error
}

Repository to store inventory information

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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