sprawl: github.com/sprawl/sprawl/interfaces Index | Files

package interfaces

import "github.com/sprawl/sprawl/interfaces"


Package Files

ChannelService.go Config.go Logger.go NodeService.go OrderService.go P2p.go Storage.go

type ChannelService Uses

type ChannelService interface {
    RegisterStorage(db Storage)
    RegisterP2p(p2p P2p)
    Join(ctx context.Context, in *pb.JoinRequest) (*pb.JoinResponse, error)
    Leave(ctx context.Context, in *pb.ChannelSpecificRequest) (*pb.GenericResponse, error)
    GetChannel(ctx context.Context, in *pb.ChannelSpecificRequest) (*pb.Channel, error)
    GetAllChannels(ctx context.Context, in *pb.Empty) (*pb.ChannelListResponse, error)

ChannelService is an interface to the Channel endpoints in sprawl.proto

type Config Uses

type Config interface {
    ReadConfig(configPath string)
    Get(variable string) interface{}
    GetString(variable string) string
    GetUint(variable string) uint
    GetBool(variable string) bool

Config is an interface to viper

type Logger Uses

type Logger interface {
    Debug(args ...interface{})
    Debugf(format string, args ...interface{})
    Info(args ...interface{})
    Infof(format string, args ...interface{})
    Warn(args ...interface{})
    Warnf(format string, args ...interface{})
    Error(args ...interface{})
    Errorf(format string, args ...interface{})
    Fatal(args ...interface{})
    Fatalf(format string, args ...interface{})

Logger is an interface to viper

type NodeService Uses

type NodeService interface {
    RegisterP2p(p2p P2p)
    GetAllPeers(ctx context.Context, in *pb.Empty) (*pb.PeerListResponse, error)
    BlacklistPeer(ctx context.Context, in *pb.Peer) (*pb.GenericResponse, error)

type OrderService Uses

type OrderService interface {
    RegisterStorage(db Storage)
    RegisterP2p(p2p P2p)
    Create(ctx context.Context, in *pb.CreateRequest) (*pb.CreateResponse, error)
    Receive(in []byte) error
    Delete(ctx context.Context, in *pb.OrderSpecificRequest) (*pb.GenericResponse, error)
    Lock(ctx context.Context, in *pb.OrderSpecificRequest) (*pb.GenericResponse, error)
    Unlock(ctx context.Context, in *pb.OrderSpecificRequest) (*pb.GenericResponse, error)
    GetOrder(ctx context.Context, in *pb.OrderSpecificRequest) (*pb.Order, error)
    GetAllOrders(ctx context.Context, in *pb.Empty) (*pb.OrderListResponse, error)

OrderService is an interface to the Order endpoints in sprawl.proto

type P2p Uses

type P2p interface {
    RegisterOrderService(orders OrderService)
    RegisterChannelService(channels ChannelService)
    Send(message *pb.WireMessage)
    Subscribe(channel *pb.Channel)
    Unsubscribe(channel *pb.Channel)
    GetAllPeers() []string
    BlacklistPeer(peerId *pb.Peer)

type Prefix Uses

type Prefix string

Prefix is a type used to prefix all entries in Storage

const (
    // OrderPrefix is the prefix used to signify all orders in Storage
    OrderPrefix Prefix = "order-"
    // ChannelPrefix is the prefix used to signify all channels in Storage
    ChannelPrefix Prefix = "channel-"

type Storage Uses

type Storage interface {
    SetDbPath(dbPath string)
    Run() error
    Has(key []byte) (bool, error)
    Get(key []byte) ([]byte, error)
    Put(key []byte, data []byte) error
    Delete(key []byte) error
    GetAll() (map[string]string, error)
    GetAllWithPrefix(prefix string) (map[string]string, error)
    DeleteAll() error
    DeleteAllWithPrefix(prefix string) error

Storage defines a database interface that works with Sprawl

Package interfaces imports 2 packages (graph) and is imported by 8 packages. Updated 2020-01-28. Refresh now. Tools for package owners.