coll_stamp

package
v0.0.0-...-3b8f57b Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2015 License: GPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientToTSTimeout error = errors.New("client timeouted on waiting for response")
View Source
var MAX_N_SECONDS int = 1 * 60 * 60 // 1 hours' worth of seconds

time we wait between rounds

Functions

func AggregateStats

func AggregateStats(buck, roundsAfter, times []int64) string

func GetSuite

func GetSuite(suite string) abstract.Suite

func Run

func Run(app *config.AppConfig, proto *deploy.Config)

func RunClient

func RunClient(server string, nmsgs int, name string, rate int)

func RunServer

func RunServer(hostname, app string, rounds int, rootwait int, debug int, testConnect bool,
	failureRate, rFail, fFail int, logger, suite string)

func RunTimestamper

func RunTimestamper(hc *config.HostConfig, nclients int, hostnameSlice ...string) ([]*Server, []*Client, error)

run each host in hostnameSlice with the number of clients given

Types

type BlockReply

type BlockReply struct {
	Dat [][]byte // Content of block(s) requested
}

type BlockRequest

type BlockRequest struct {
	Ids []hashid.HashId // Hash of block(s) requested
}

XXX not sure we need block requests?

type Client

type Client struct {
	Mux sync.Mutex // coarse grained mutex

	Servers map[string]coconet.Conn // signing nodes I work/ communicate with

	// roundChan   chan int // round numberd are sent in as rounds change
	Error error
	// contains filtered or unexported fields
}

func NewClient

func NewClient(name string) (c *Client)

func (*Client) AddServer

func (c *Client) AddServer(name string, conn coconet.Conn)

func (*Client) Close

func (c *Client) Close()

func (*Client) Name

func (c *Client) Name() string

func (*Client) ProcessStampReply

func (c *Client) ProcessStampReply(tsm *TimeStampMessage)

func (*Client) PutToServer

func (c *Client) PutToServer(name string, data coconet.BinaryMarshaler) error

Send data to server given by name (data should be a timestamp request)

func (*Client) TimeStamp

func (c *Client) TimeStamp(val []byte, TSServerName string) error

When client asks for val to be timestamped It blocks until it get a coll_stamp reply back

type EntryReply

type EntryReply struct {
	Log SignedEntry // Signed log entry
}

type EntryRequest

type EntryRequest struct {
	Seq SeqNo // Sequence number of old entry requested
}

Request to obtain an old log-entry and, optionally, a cryptographic proof that it happened before a given newer entry. The TSServer may be unable to process if Seq is beyond the retention window.

type ErrorReply

type ErrorReply struct {
	Msg string // Human-readable error message
}

type LogEntry

type LogEntry struct {
	Seq  SeqNo         // Consecutively-incrementing log entry sequence number
	Root hashid.HashId // Merkle root of values committed this time-step
	Time *int64        // Optional wall-clock time this entry was created
}

type MessageType

type MessageType int
const (
	Error MessageType = iota
	StampRequestType
	StampReplyType
)

type MustReplyMessage

type MustReplyMessage struct {
	Tsm TimeStampMessage
	To  string // name of reply destination
}

struct to ease keeping track of who requires a reply after tsm is processed/ aggregated by the TSServer

type ProofReply

type ProofReply struct {
	Prf proof.Proof // Requested Merkle proof
}

type ProofRequest

type ProofRequest struct {
	Old, New SeqNo // Sequence number of old and new log records
}

Request a cryptographic Merkle proof that log-entry Old happened before New. Produces a path to a Merkle tree node containing a hash of the node itself and the root of the history values committed within the node. The TSServer may be unable to process if Old is beyond the retention window.

type SeqNo

type SeqNo byte

type Server

type Server struct {
	sign.Signer

	Clients map[string]coconet.Conn

	Queue      [][]MustReplyMessage
	READING    int
	PROCESSING int

	// Leaves, Root and Proof for a round
	Leaves []hashid.HashId // can be removed after we verify protocol
	Root   hashid.HashId
	Proofs []proof.Proof

	Logger   string
	Hostname string
	App      string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(signer sign.Signer) *Server

func (*Server) AggregateCommits

func (s *Server) AggregateCommits(view int) []byte

func (*Server) Close

func (s *Server) Close()

func (*Server) ConnectToLogger

func (s *Server) ConnectToLogger()

func (*Server) Listen

func (s *Server) Listen() error

listen for clients connections this server needs to be running on a different port than the Signer that is beneath it

func (*Server) ListenToClients

func (s *Server) ListenToClients()

Used for goconns should only be used if clients are created in batch

func (*Server) LogReRun

func (s *Server) LogReRun(nextRole string, curRole string)

func (*Server) OnAnnounce

func (s *Server) OnAnnounce() sign.CommitFunc

func (*Server) OnDone

func (s *Server) OnDone() sign.DoneFunc

func (*Server) PutToClient

func (s *Server) PutToClient(name string, data coconet.BinaryMarshaler)

Send message to client given by name

func (*Server) Run

func (s *Server) Run(role string, nRounds int)

Listen on client connections. If role is root also send annoucement for all of the nRounds

type SignedEntry

type SignedEntry struct {
	Ent []byte // Encoded LogEntry to which the signature applies
	Sig []byte // Digital signature on the LogEntry
}

type StampReply

type StampReply struct {
	Sig []byte      // Signature on the root
	Prf proof.Proof // Merkle proof of value
}

func (StampReply) MarshalBinary

func (Srep StampReply) MarshalBinary() ([]byte, error)

func (*StampReply) UnmarshalBinary

func (Srep *StampReply) UnmarshalBinary(data []byte) error

type StampRequest

type StampRequest struct {
	Val []byte // Hash-size value to timestamp
}

func (StampRequest) MarshalBinary

func (Sreq StampRequest) MarshalBinary() ([]byte, error)

func (*StampRequest) UnmarshalBinary

func (Sreq *StampRequest) UnmarshalBinary(data []byte) error

type TimeStampMessage

type TimeStampMessage struct {
	ReqNo SeqNo // Request sequence number
	// ErrorReply *ErrorReply // Generic error reply to any request
	Type MessageType
	Sreq *StampRequest
	Srep *StampReply
}

func (TimeStampMessage) MarshalBinary

func (tsm TimeStampMessage) MarshalBinary() ([]byte, error)

func (*TimeStampMessage) UnmarshalBinary

func (sm *TimeStampMessage) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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