client

package
v0.0.0-...-d12bbc4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 7 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, vkey, 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) PartialLeavesAtOffset

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

PartialLeavesAtOffset gets the final tile of incomplete leaves.

Jump to

Keyboard shortcuts

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