notifier

package
v0.0.0-...-b276000 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const IDSize = 16
View Source
const LastReadLength = 2

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ServerAddr string
	// server endpoint for polling
	// separate endpoint for notifications?
	PublicKey [32]byte
}

func (Config) DialService

func (c Config) DialService(ctx context.Context) (pb.NotifierClient, error)

type DB

type DB interface {
	Put(deaddropID DeadDropID, message *pb.Notification) error
	Fetch(deaddropID DeadDropID, handler func(messages []*pb.Notification) (dropPrefix int, err error)) error
}

type DeadDropClient

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

func NewRandomDeadDropClient

func NewRandomDeadDropClient(conf *Config) (*DeadDropClient, error)

func (*DeadDropClient) MakeAddressV1

func (dcl *DeadDropClient) MakeAddressV1(id uint16) []byte

func (*DeadDropClient) Poll

func (dcl *DeadDropClient) Poll(ctx context.Context) ([]*pb.Notification, error)

type DeadDropID

type DeadDropID [IDSize]byte

type InMemoryDB

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

func (*InMemoryDB) Fetch

func (memdb *InMemoryDB) Fetch(deaddropID DeadDropID, handler func(messages []*pb.Notification) (dropPrefix int, err error)) error

func (*InMemoryDB) Put

func (memdb *InMemoryDB) Put(deaddropID DeadDropID, message *pb.Notification) error

type NotifierClient

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

func NewNotifierClient

func NewNotifierClient(conf *Config) (*NotifierClient, error)

func (*NotifierClient) Notify

func (nc *NotifierClient) Notify(ctx context.Context, address []byte, msg []byte) error

type PollServer

type PollServer struct {
	pb.UnimplementedNotifierServer
	// contains filtered or unexported fields
}

func (*PollServer) FetchNotifications

func (ps *PollServer) FetchNotifications(ctx context.Context, req *pb.FetchRequest) (*pb.FetchResponse, error)

func (*PollServer) PostNotificationV1

func (ps *PollServer) PostNotificationV1(ctx context.Context, req *pb.PostRequestV1) (*pb.Empty, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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