Documentation
¶
Index ¶
- Constants
- func AddCheckpointRequest(oldSize int64, proof []tlog.Hash, signedCheckpoint []byte) ([]byte, error)
- func AddEntriesRequest(logOrigin string, uploadStart, uploadEnd int64, ticket []byte, ...) ([]byte, error)
- func EntryPackage(entries [][]byte, proof []tlog.Hash) ([]byte, error)
- func ParseSizeResponse(body []byte) (int64, error)
- type MirrorInfo
- type Package
Constants ¶
const MaxPackagesPerRequest = 32
MaxPackagesPerRequest is the most entry packages a client should send in one add-entries request per c2sp.org/tlog-mirror.
Variables ¶
This section is empty.
Functions ¶
func AddCheckpointRequest ¶
func AddCheckpointRequest(oldSize int64, proof []tlog.Hash, signedCheckpoint []byte) ([]byte, error)
AddCheckpointRequest builds the add-checkpoint request body per c2sp.org/tlog-witness. The proof must be a Merkle consistency proof from oldSize to the checkpoint's size, empty when oldSize is zero.
func AddEntriesRequest ¶
func AddEntriesRequest(logOrigin string, uploadStart, uploadEnd int64, ticket []byte, packages [][]byte) ([]byte, error)
AddEntriesRequest builds the add-entries request body. The packages must be a prefix of the canonical sequence for [uploadStart, uploadEnd), marshaled by EntryPackage.
func EntryPackage ¶
EntryPackage builds the wire form of one entry package.
func ParseSizeResponse ¶
ParseSizeResponse parses the text/x.tlog.size body of a "409 Conflict" add-checkpoint response, which carries the tree size of the mirror's latest pending checkpoint.
Types ¶
type MirrorInfo ¶
type MirrorInfo struct {
// TreeSize is the tree size to use as upload_end in the next request. The
// mirror repeats the request's upload_end if it is still a pending
// checkpoint, otherwise it sends its current pending checkpoint's size.
TreeSize int64
// NextEntry is the entry to use as upload_start in the next request. It is
// the first entry the mirror does not hold.
NextEntry int64
// Ticket is an opaque ticket value to send back in the next request.
Ticket []byte
}
MirrorInfo is a parsed text/x.tlog.mirror-info body from a "409 Conflict" or "202 Accepted" add-entries response.
func ParseMirrorInfo ¶
func ParseMirrorInfo(body []byte) (MirrorInfo, error)
ParseMirrorInfo parses a text/x.tlog.mirror-info response body.
type Package ¶
type Package struct {
// SubtreeStart begins the subtree consistency proof's interval,
// [SubtreeStart, End).
SubtreeStart int64
// EntriesStart begins the carried entries, [EntriesStart, End), exceeding
// SubtreeStart only for the first package of an upload that does not begin
// on a package boundary.
EntriesStart int64
// End is the exclusive end of both intervals.
End int64
}
Package holds the boundaries of one entry package of an add-entries upload.