backend

package
v0.0.0-...-c17a846 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2017 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorOK         = 0 // Everything's cool
	ErrorExists     = 1 // Digest exists
	ErrorNotFound   = 2 // Generic not found error
	ErrorNotAllowed = 3 // Generic not allowed error
)

Variables

View Source
var (
	ErrTryAgainLater     = errors.New("busy, try again later")
	ErrTimestampNotFound = errors.New("timestamp not found")
)

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Return timestamp information for given digests.
	Get([][sha256.Size]byte) ([]GetResult, error)

	// Return all hashes for given timestamps.
	GetTimestamps([]int64) ([]TimestampResult, error)

	// Store hashes and return timestamp and associated errors.  Put is
	// allowed to return transient errors.
	Put([][sha256.Size]byte) (int64, []PutResult, error)

	// Close performs cleanup of the backend.
	Close()
}

type FlushRecord

type FlushRecord struct {
	Root           [sha256.Size]byte    // Merkle root
	Hashes         []*[sha256.Size]byte // All digests
	Tx             chainhash.Hash       // Tx that anchored merkle tree
	ChainTimestamp int64                // Blockchain timestamp, if available
	FlushTimestamp int64                // Time flush actually happened
}

FlushRecord contains blockchain information. This information only becomes available once digests are anchored in the blockchain. The information contained in this record is subject to change due to blockchain realities (e.g. a fork).

type GetResult

type GetResult struct {
	Digest            [sha256.Size]byte   // Digest
	ErrorCode         uint                // Error code
	Timestamp         int64               // Server timestamp
	AnchoredTimestamp int64               // Anchored timestamp
	Tx                chainhash.Hash      // Anchor Tx
	MerkleRoot        [sha256.Size]byte   // Merkle root
	MerklePath        merkle.MerkleBranch // Auth path
}

GetResult is a cooked result returned by the backend.

type PutResult

type PutResult struct {
	Digest    [sha256.Size]byte
	ErrorCode uint
}

PutResult is a cooked error returned by the backend.

type TimestampResult

type TimestampResult struct {
	Timestamp         int64               // Collection timestamp
	ErrorCode         uint                // Overall result
	AnchoredTimestamp int64               // Anchored timestamp
	Tx                chainhash.Hash      // Anchor Tx
	MerkleRoot        [sha256.Size]byte   // Merkle root
	Digests           [][sha256.Size]byte // All digests
}

TimestampResult is a cooked error returned by the backend.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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