merkle

package
v0.0.0-...-fa626c8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownFileType = errors.New("unknown node type")
)

Functions

func ParseDataFile

func ParseDataFile(r io.Reader) (io.Reader, error)

Types

type BytesStack

type BytesStack [][]byte

func NewBytesStack

func NewBytesStack() BytesStack

func (*BytesStack) IsEmpty

func (s *BytesStack) IsEmpty() bool

func (*BytesStack) Pop

func (s *BytesStack) Pop() []byte

func (*BytesStack) Push

func (s *BytesStack) Push(value []byte)

type Callback

type Callback func(parent []byte, child []byte, side NodeSide) ([]byte, error)

type DataFile

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

func NewDataFile

func NewDataFile(r io.Reader) *DataFile

func (*DataFile) Read

func (d *DataFile) Read(b []byte) (int, error)

type FileType

type FileType byte
const (
	MetaType FileType
	DataType
	RootType
)

func DetectFileType

func DetectFileType(r io.Reader) (io.Reader, FileType, error)

func (FileType) String

func (ft FileType) String() string

type MetaFile

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

func NewMetaFile

func NewMetaFile() *MetaFile

func ParseMetaFile

func ParseMetaFile(r io.Reader) (*MetaFile, error)

func (*MetaFile) HasLeft

func (m *MetaFile) HasLeft() bool

func (*MetaFile) HasRight

func (m *MetaFile) HasRight() bool

func (*MetaFile) Hash

func (m *MetaFile) Hash() []byte

func (*MetaFile) Left

func (m *MetaFile) Left() []byte

func (*MetaFile) Read

func (m *MetaFile) Read(b []byte) (int, error)

func (*MetaFile) Right

func (m *MetaFile) Right() []byte

func (*MetaFile) Write

func (m *MetaFile) Write(b []byte) (int, error)

type Node

type Node struct {
	Left  *Node
	Right *Node

	Value []byte
	// contains filtered or unexported fields
}

type NodeSide

type NodeSide byte
const (
	LeftSide NodeSide
	RightSide
)

func (NodeSide) String

func (ns NodeSide) String() string

type Storage

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

func New

func New(getter storage.Getter, putter storage.Putter, lister storage.Lister, blockSize int64) *Storage

func (*Storage) Get

func (s *Storage) Get(ctx context.Context, hashValue []byte) (io.ReadCloser, error)

func (*Storage) List

func (s *Storage) List() (storage.IteratorFunc, storage.CancelFunc)

func (*Storage) Put

func (s *Storage) Put(ctx context.Context, r io.Reader) ([]byte, int64, error)

type Tree

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

func NewTree

func NewTree(callback Callback) *Tree

func (*Tree) Add

func (t *Tree) Add(value []byte) error

func (*Tree) String

func (t *Tree) String() string

Jump to

Keyboard shortcuts

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