server

package
v0.0.0-...-57c8b1d Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogProcessor

type LogProcessor interface {
	Process()
	Stop()
	SendProofs(delta *mpt.DeltaMPT) error
	ProcessMessage(t wire.MessageType, m []byte) error
	ProcessRequestProof(msg *wire.RequestProofMessage) error
	ProcessCreateLog(scls *wire.SignedCreateLogStatement) error
	ProcessAppendLog(sls *wire.SignedLogStatement) error
}

Interface to be able to mock the LogProcessor for the test cases

func NewLogProcessor

func NewLogProcessor(c net.Conn, srv *Server) LogProcessor

type Server

type Server struct {

	// The last state of the MPT when we last committed
	LastCommitMpt *mpt.FullMPT

	// The state of the MPT upon confirmation from the chain (mined commitment
	// transaction)
	LastConfirmedCommitMpt *mpt.FullMPT

	// The commitment server automatically commits every time a block has been
	// found. This can be turned off by switching this boolean off.
	AutoCommit bool

	// This can be used to switch off keeping a copy of the tree at the commitment
	// point (used to generate client-side proofs) - this is needed for some tests
	// and benchmarks where this is not needed to save time
	KeepCommitmentTree bool

	// Commit to the blockchain every N blocks (if AutoCommit enabled)
	CommitEveryNBlocks int

	// Last block that a commitment was initiated
	LastCommitHeight int

	// Blocks to rescan on startup
	RescanBlocks int

	// Full server also runs an actual Bitcoin wallet and commits to the actual chain
	Full bool

	// Allow disable signature verification to save needless processing  time when
	// initializing benchmarks
	CheckSignatures bool
	// contains filtered or unexported fields
}

func NewServer

func NewServer(addr string, rescanBlocks int) (*Server, error)

func (*Server) Commit

func (srv *Server) Commit() error

func (*Server) Commitment

func (srv *Server) Commitment() []byte

func (*Server) CountNodes

func (srv *Server) CountNodes() int

func (*Server) CountRecalculations

func (srv *Server) CountRecalculations() int

func (*Server) GetCommitmentDetails

func (srv *Server) GetCommitmentDetails(commitment [32]byte) (*wire.Commitment, error)

func (*Server) GetCommitmentHistory

func (srv *Server) GetCommitmentHistory(sinceCommitment [32]byte) []*wire.Commitment

func (*Server) GetDeltaProofForKeys

func (srv *Server) GetDeltaProofForKeys(keys [][]byte) (*mpt.DeltaMPT, error)

func (*Server) GetNextLogIndex

func (srv *Server) GetNextLogIndex(logID [32]byte) uint64

func (*Server) GetProofForKeys

func (srv *Server) GetProofForKeys(keys [][]byte) (*mpt.PartialMPT, error)

func (*Server) GetPubKeyForLogID

func (srv *Server) GetPubKeyForLogID(logID [32]byte) ([33]byte, error)

func (*Server) RegisterLogID

func (srv *Server) RegisterLogID(logID [32]byte, controllingKey [33]byte) error

func (*Server) RegisterLogStatement

func (srv *Server) RegisterLogStatement(logID [32]byte, index uint64, statement []byte) error

func (*Server) Run

func (srv *Server) Run() error

func (*Server) Stop

func (srv *Server) Stop()

func (*Server) TreeGraph

func (srv *Server) TreeGraph() []byte

func (*Server) TreeSize

func (srv *Server) TreeSize() int

type ServerLogProcessor

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

func (*ServerLogProcessor) AckAppendLog

func (lp *ServerLogProcessor) AckAppendLog(sls *wire.SignedLogStatement) error

func (*ServerLogProcessor) CommitAppendLog

func (lp *ServerLogProcessor) CommitAppendLog(sls *wire.SignedLogStatement) error

func (*ServerLogProcessor) Process

func (lp *ServerLogProcessor) Process()

func (*ServerLogProcessor) ProcessAppendLog

func (lp *ServerLogProcessor) ProcessAppendLog(sls *wire.SignedLogStatement) error

func (*ServerLogProcessor) ProcessCreateLog

func (lp *ServerLogProcessor) ProcessCreateLog(scls *wire.SignedCreateLogStatement) error

func (*ServerLogProcessor) ProcessMessage

func (lp *ServerLogProcessor) ProcessMessage(t wire.MessageType, m []byte) error

func (*ServerLogProcessor) ProcessRequestCommitmentDetails

func (lp *ServerLogProcessor) ProcessRequestCommitmentDetails(pm *wire.RequestCommitmentDetailsMessage) error

func (*ServerLogProcessor) ProcessRequestCommitmentHistory

func (lp *ServerLogProcessor) ProcessRequestCommitmentHistory(pm *wire.RequestCommitmentHistoryMessage) error

func (*ServerLogProcessor) ProcessRequestDeltaProof

func (lp *ServerLogProcessor) ProcessRequestDeltaProof(msg *wire.RequestProofMessage) error

func (*ServerLogProcessor) ProcessRequestProof

func (lp *ServerLogProcessor) ProcessRequestProof(msg *wire.RequestProofMessage) error

func (*ServerLogProcessor) SendProofs

func (lp *ServerLogProcessor) SendProofs(delta *mpt.DeltaMPT) error

func (*ServerLogProcessor) Stop

func (lp *ServerLogProcessor) Stop()

func (*ServerLogProcessor) SubscribeToLog

func (lp *ServerLogProcessor) SubscribeToLog(logID [32]byte)

func (*ServerLogProcessor) VerifyAppendLog

func (lp *ServerLogProcessor) VerifyAppendLog(sls *wire.SignedLogStatement) error

type ServerState

type ServerState struct {
	LastCommitmentTree          []byte
	LastConfirmedCommitmentTree []byte
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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