c2s

package
v0.0.0-...-a77e882 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*ClientContext
	// contains filtered or unexported fields
}

func (*Client) Close

func (c *Client) Close() error

func (*Client) Publish

func (c *Client) Publish(files []bson.Document) error

func (*Client) Query

func (c *Client) Query(terms bson.Document, max int) ([]bson.Element, error)

func (*Client) Retract

func (c *Client) Retract(files []bson.Document) error

func (*Client) RetractAll

func (c *Client) RetractAll() error

func (*Client) Status

func (c *Client) Status() (Status, error)

type ClientContext

type ClientContext struct {
	Arena proto.Allocator
	KP    proto.KeyPair
}

func (*ClientContext) NewClient

func (cc *ClientContext) NewClient(conn io.ReadWriteCloser) (cli *Client, err error)

func (*ClientContext) Validate

func (cc *ClientContext) Validate() bool

type Server

type Server struct {
	Arena proto.Allocator
	Rand  io.Reader
	Auth  Srv_Auth
	Query Srv_Queries
}

func (*Server) Serve

func (s *Server) Serve(conn io.ReadWriteCloser)

func (*Server) Validate

func (s *Server) Validate() bool

type Srv_Auth

type Srv_Auth interface {
	Login(pub []byte, domain string) Srv_Token
}

type Srv_Queries

type Srv_Queries interface {
	RetractAll(tok Srv_Token)

	Publish(tok Srv_Token, doc bson.Document)
	Retract(tok Srv_Token, doc bson.Document)

	Query(tok Srv_Token, terms bson.Document, max int) bson.Document
}

type Srv_Token

type Srv_Token interface {
	Status() Status
	Domain() string
}

type Status

type Status int32
const (
	Pending Status = iota
	Rejected
	Accepted
)

Jump to

Keyboard shortcuts

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