Documentation ¶
Overview ¶
Copyright 2021 CodeNotary, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 CodeNotary, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 CodeNotary, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
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) 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 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) WithReadOnly(readOnly bool) *Options
- func (opts *Options) WithSynced(synced bool) *Options
Constants ¶
const DefaultCompressionFormat = appendable.DefaultCompressionFormat
const DefaultCompressionLevel = appendable.DefaultCompressionLevel
const DefaultDataCacheSlots = 1_000
const DefaultDigestsCacheSlots = 100_000
const DefaultFileMode = os.FileMode(0755)
const DefaultFileSize = multiapp.DefaultFileSize
const LeafPrefix = byte(0)
const (
MetaVersion = "VERSION"
)
const NodePrefix = byte(1)
const Version = 1
Variables ¶
var ErrAlreadyClosed = errors.New("already closed")
var ErrCorruptedCLog = errors.New("commit log is corrupted")
var ErrEmptyTree = errors.New("empty tree")
var ErrIllegalArguments = errors.New("illegal arguments")
var ErrReadOnly = errors.New("cannot append when openned in read-only mode")
var ErrUnexistentData = errors.New("attempt to read unexistent data")
var ErrorCorruptedData = errors.New("data log is corrupted")
var ErrorCorruptedDigests = errors.New("hash log is corrupted")
var ErrorPathIsNotADirectory = errors.New("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 Options ¶
type Options struct {
// contains filtered or unexported fields
}
func DefaultOptions ¶
func DefaultOptions() *Options