client

package
v0.0.0-...-d1f79e0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package client contains a basic client for the SumDB log.

Index

Constants

View Source
const HashLenBytes = 32

HashLenBytes is the number of bytes in the SumDB hashes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkpoint

type Checkpoint struct {
	*tlog.Tree

	Raw []byte
}

Checkpoint is a parsed Checkpoint and the raw bytes that it came from.

type Fetcher

type Fetcher interface {
	// GetData gets the data at the given path, or returns an error.
	GetData(path string) ([]byte, error)
}

Fetcher gets data paths. This allows impl to be swapped for tests.

type HTTPFetcher

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

HTTPFetcher gets the data over HTTP(S).

func (*HTTPFetcher) GetData

func (f *HTTPFetcher) GetData(path string) ([]byte, error)

GetData gets the data.

type SumDBClient

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

SumDBClient provides access to information from the Sum DB.

func NewSumDB

func NewSumDB(height int, verifier note.Verifier, url string, c *http.Client) *SumDBClient

NewSumDB creates a new client that fetches tiles of the given height.

func (*SumDBClient) FullLeavesAtOffset

func (c *SumDBClient) FullLeavesAtOffset(offset int) ([][]byte, error)

FullLeavesAtOffset gets the Nth chunk of 2**height leaves.

func (*SumDBClient) LatestCheckpoint

func (c *SumDBClient) LatestCheckpoint() (*Checkpoint, error)

LatestCheckpoint gets the freshest Checkpoint.

func (*SumDBClient) ParseCheckpointNote

func (c *SumDBClient) ParseCheckpointNote(checkpoint []byte) (*Checkpoint, error)

ParseCheckpointNote parses a previously acquired raw checkpoint note data.

func (*SumDBClient) PartialLeavesAtOffset

func (c *SumDBClient) PartialLeavesAtOffset(offset, count int) ([][]byte, error)

PartialLeavesAtOffset gets the final tile of incomplete leaves.

func (*SumDBClient) TileHashes

func (c *SumDBClient) TileHashes(level, offset, partial int) ([]tlog.Hash, error)

TileHashes gets the hashes at the given level and offset. If partial > 0 then a partial tile will be fetched with the number of hashes. TODO(mhutchinson): Add better tests for this.

Jump to

Keyboard shortcuts

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