Documentation ¶
Index ¶
- Constants
- Variables
- func EvalConsistency(cproof [][sha256.Size]byte, i, j uint64) ([sha256.Size]byte, [sha256.Size]byte)
- func EvalInclusion(iproof [][sha256.Size]byte, i, j uint64, iLeaf [sha256.Size]byte) [sha256.Size]byte
- func EvalLastInclusion(iproof [][sha256.Size]byte, i uint64, leaf [sha256.Size]byte) [sha256.Size]byte
- func VerifyConsistency(cproof [][sha256.Size]byte, i, j uint64, iRoot, jRoot [sha256.Size]byte) bool
- func VerifyInclusion(iproof [][sha256.Size]byte, i, j uint64, iLeaf, jRoot [sha256.Size]byte) bool
- func VerifyLastInclusion(iproof [][sha256.Size]byte, i uint64, leaf, root [sha256.Size]byte) bool
- type AHtree
- func (t *AHtree) Append(d []byte) (n uint64, h [sha256.Size]byte, err error)
- func (t *AHtree) Close() error
- func (t *AHtree) ConsistencyProof(i, j uint64) (p [][sha256.Size]byte, err error)
- func (t *AHtree) DataAt(n uint64) ([]byte, error)
- func (t *AHtree) InclusionProof(i, j uint64) (p [][sha256.Size]byte, err error)
- func (t *AHtree) ResetSize(newSize uint64) error
- func (t *AHtree) Root() (n uint64, r [sha256.Size]byte, err error)
- func (t *AHtree) RootAt(n uint64) (r [sha256.Size]byte, err error)
- func (t *AHtree) Size() uint64
- func (t *AHtree) Sync() error
- type AppFactoryFunc
- type Options
- func (opts *Options) Validate() error
- func (opts *Options) WithAppFactory(appFactory AppFactoryFunc) *Options
- func (opts *Options) WithAutoSync(autoSync bool) *Options
- func (opts *Options) WithCompresionLevel(compressionLevel int) *Options
- func (opts *Options) WithCompressionFormat(compressionFormat int) *Options
- func (opts *Options) WithDataCacheSlots(cacheSlots int) *Options
- func (opts *Options) WithDigestsCacheSlots(cacheSlots int) *Options
- func (opts *Options) WithFileMode(fileMode os.FileMode) *Options
- func (opts *Options) WithFileSize(fileSize int) *Options
- func (opts *Options) WithReadBufferSize(size int) *Options
- func (opts *Options) WithReadOnly(readOnly bool) *Options
- func (opts *Options) WithRetryableSync(retryableSync bool) *Options
- func (opts *Options) WithSyncThld(syncThld int) *Options
- func (opts *Options) WithWriteBufferSize(size int) *Options
Constants ¶
View Source
const DefaultCompressionFormat = appendable.DefaultCompressionFormat
View Source
const DefaultCompressionLevel = appendable.DefaultCompressionLevel
View Source
const DefaultDataCacheSlots = 1_000
View Source
const DefaultDigestsCacheSlots = 100_000
View Source
const DefaultFileMode = os.FileMode(0755)
View Source
const DefaultFileSize = multiapp.DefaultFileSize
View Source
const DefaultSyncThld = 100_000
View Source
const DefaultWriteBufferSize = 1 << 24 //16Mb
View Source
const LeafPrefix = byte(0)
View Source
const (
MetaVersion = "VERSION"
)
View Source
const NodePrefix = byte(1)
View Source
const Version = 1
Variables ¶
View Source
var ErrAlreadyClosed = errors.New("ahtree: already closed")
View Source
var ErrCannotResetToLargerSize = errors.New("ahtree: can not reset the tree to a larger size")
View Source
var ErrEmptyTree = errors.New("ahtree: empty tree")
View Source
var ErrIllegalArguments = errors.New("ahtree: illegal arguments")
View Source
var ErrInvalidOptions = fmt.Errorf("%w: invalid options", ErrIllegalArguments)
View Source
var ErrReadOnly = errors.New("ahtree: read-only mode")
View Source
var ErrUnexistentData = errors.New("ahtree: attempt to read unexistent data")
View Source
var ErrorCorruptedData = errors.New("ahtree: data log is corrupted")
View Source
var ErrorCorruptedDigests = errors.New("ahtree: hash log is corrupted")
View Source
var ErrorPathIsNotADirectory = errors.New("ahtree: path is not a directory")
Functions ¶
func EvalConsistency ¶
func EvalInclusion ¶
func EvalLastInclusion ¶
func VerifyConsistency ¶
func VerifyInclusion ¶
Types ¶
type AHtree ¶
type AHtree struct {
// contains filtered or unexported fields
}
AHtree stands for Appendable Hash Tree
func OpenWith ¶
func OpenWith(pLog, dLog, cLog appendable.Appendable, opts *Options) (*AHtree, error)
func (*AHtree) ConsistencyProof ¶
func (*AHtree) InclusionProof ¶
type AppFactoryFunc ¶ added in v1.0.5
type AppFactoryFunc func( rootPath string, subPath string, opts *multiapp.Options, ) (appendable.Appendable, error)
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func DefaultOptions ¶
func DefaultOptions() *Options
func (*Options) WithAppFactory ¶ added in v1.0.5
func (opts *Options) WithAppFactory(appFactory AppFactoryFunc) *Options
func (*Options) WithAutoSync ¶ added in v1.3.2
func (*Options) WithCompresionLevel ¶
func (*Options) WithCompressionFormat ¶
func (*Options) WithDataCacheSlots ¶
func (*Options) WithDigestsCacheSlots ¶
func (*Options) WithFileSize ¶
func (*Options) WithReadBufferSize ¶ added in v1.3.2
func (*Options) WithReadOnly ¶
func (*Options) WithRetryableSync ¶ added in v1.3.2
func (*Options) WithSyncThld ¶ added in v1.3.2
func (*Options) WithWriteBufferSize ¶ added in v1.3.2
Click to show internal directories.
Click to hide internal directories.