Documentation ¶
Overview ¶
Copyright 2022 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 2022 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 2022 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 2022 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 2022 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 2022 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 2022 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 2022 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 2022 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 2022 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 2022 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 2022 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 EntrySpecDigest_v0(kv *EntrySpec) [sha256.Size]byte
- func EntrySpecDigest_v1(kv *EntrySpec) [sha256.Size]byte
- func TxEntryDigest_v1_1(e *TxEntry) ([sha256.Size]byte, error)
- func TxEntryDigest_v1_2(e *TxEntry) ([sha256.Size]byte, error)
- func VerifyDualProof(proof *DualProof, sourceTxID, targetTxID uint64, ...) bool
- func VerifyInclusion(proof *htree.InclusionProof, entryDigest, root [sha256.Size]byte) bool
- func VerifyLinearProof(proof *LinearProof, sourceTxID, targetTxID uint64, ...) bool
- type AppFactoryFunc
- type DualProof
- type EntrySpec
- type EntrySpecDigest
- type FilterFn
- type ImmuStore
- func (s *ImmuStore) Alh() (uint64, [sha256.Size]byte)
- func (s *ImmuStore) BlInfo() (uint64, error)
- func (s *ImmuStore) Close() error
- func (s *ImmuStore) CommitWith(...) (*TxHeader, error)
- func (s *ImmuStore) CompactIndex() error
- func (s *ImmuStore) DualProof(sourceTx, targetTx *Tx) (proof *DualProof, err error)
- func (s *ImmuStore) ExistKeyWith(prefix []byte, neq []byte) (bool, error)
- func (s *ImmuStore) ExportTx(txID uint64, tx *Tx) ([]byte, error)
- func (s *ImmuStore) FlushIndex(cleanupPercentage float32, synced bool) error
- func (s *ImmuStore) Get(key []byte) (valRef ValueRef, err error)
- func (s *ImmuStore) GetWith(key []byte, filters ...FilterFn) (valRef ValueRef, err error)
- func (s *ImmuStore) History(key []byte, offset uint64, descOrder bool, limit int) (txs []uint64, err error)
- func (s *ImmuStore) IndexInfo() uint64
- func (s *ImmuStore) IsClosed() bool
- func (s *ImmuStore) LinearProof(sourceTxID, targetTxID uint64) (*LinearProof, error)
- func (s *ImmuStore) MaxConcurrency() int
- func (s *ImmuStore) MaxIOConcurrency() int
- func (s *ImmuStore) MaxKeyLen() int
- func (s *ImmuStore) MaxLinearProofLen() int
- func (s *ImmuStore) MaxTxEntries() int
- func (s *ImmuStore) MaxValueLen() int
- func (s *ImmuStore) NewTx() (*OngoingTx, error)
- func (s *ImmuStore) NewTxHolder() *Tx
- func (s *ImmuStore) NewTxReader(initialTxID uint64, desc bool, tx *Tx) (*TxReader, error)
- func (s *ImmuStore) NewWriteOnlyTx() (*OngoingTx, error)
- func (s *ImmuStore) ReadOnly() bool
- func (s *ImmuStore) ReadTx(txID uint64, tx *Tx) error
- func (s *ImmuStore) ReadValue(entry *TxEntry) ([]byte, error)
- func (s *ImmuStore) ReplicateTx(exportedTx []byte, waitForIndexing bool) (*TxHeader, error)
- func (s *ImmuStore) SetBlErr(err error)
- func (s *ImmuStore) Snapshot() (*Snapshot, error)
- func (s *ImmuStore) SnapshotSince(tx uint64) (*Snapshot, error)
- func (s *ImmuStore) Sync() error
- func (s *ImmuStore) Synced() bool
- func (s *ImmuStore) TxCount() uint64
- func (s *ImmuStore) UseTimeFunc(timeFunc TimeFunc) error
- func (s *ImmuStore) WaitForIndexingUpto(txID uint64, cancellation <-chan struct{}) error
- func (s *ImmuStore) WaitForTx(txID uint64, cancellation <-chan struct{}) error
- type IndexOptions
- func (opts *IndexOptions) Validate() error
- func (opts *IndexOptions) WithCacheSize(cacheSize int) *IndexOptions
- func (opts *IndexOptions) WithCleanupPercentage(cleanupPercentage float32) *IndexOptions
- func (opts *IndexOptions) WithCommitLogMaxOpenedFiles(commitLogMaxOpenedFiles int) *IndexOptions
- func (opts *IndexOptions) WithCompactionThld(compactionThld int) *IndexOptions
- func (opts *IndexOptions) WithDelayDuringCompaction(delayDuringCompaction time.Duration) *IndexOptions
- func (opts *IndexOptions) WithFlushBufferSize(flushBufferSize int) *IndexOptions
- func (opts *IndexOptions) WithFlushThld(flushThld int) *IndexOptions
- func (opts *IndexOptions) WithHistoryLogMaxOpenedFiles(historyLogMaxOpenedFiles int) *IndexOptions
- func (opts *IndexOptions) WithMaxActiveSnapshots(maxActiveSnapshots int) *IndexOptions
- func (opts *IndexOptions) WithMaxNodeSize(maxNodeSize int) *IndexOptions
- func (opts *IndexOptions) WithNodesLogMaxOpenedFiles(nodesLogMaxOpenedFiles int) *IndexOptions
- func (opts *IndexOptions) WithRenewSnapRootAfter(renewSnapRootAfter time.Duration) *IndexOptions
- func (opts *IndexOptions) WithSyncThld(syncThld int) *IndexOptions
- type KVMetadata
- func (md *KVMetadata) AsDeleted(deleted bool) error
- func (md *KVMetadata) AsNonIndexable(nonIndexable bool) error
- func (md *KVMetadata) Bytes() []byte
- func (md *KVMetadata) Deleted() bool
- func (md *KVMetadata) ExpirationTime() (time.Time, error)
- func (md *KVMetadata) ExpiredAt(mtime time.Time) bool
- func (md *KVMetadata) ExpiresAt(expiresAt time.Time) error
- func (md *KVMetadata) IsExpirable() bool
- func (md *KVMetadata) NonExpirable() *KVMetadata
- func (md *KVMetadata) NonIndexable() bool
- type KeyIndex
- type KeyReader
- type KeyReaderSpec
- type LinearProof
- type NotificationType
- type OngoingTx
- func (tx *OngoingTx) AddPrecondition(c Precondition) error
- func (tx *OngoingTx) AsyncCommit() (*TxHeader, error)
- func (tx *OngoingTx) Cancel() error
- func (tx *OngoingTx) Commit() (*TxHeader, error)
- func (tx *OngoingTx) Delete(key []byte) error
- func (tx *OngoingTx) ExistKeyWith(prefix, neq []byte) (bool, error)
- func (tx *OngoingTx) Get(key []byte) (ValueRef, error)
- func (tx *OngoingTx) GetWith(key []byte, filters ...FilterFn) (ValueRef, error)
- func (tx *OngoingTx) IsWriteOnly() bool
- func (tx *OngoingTx) Metadata() *TxMetadata
- func (tx *OngoingTx) NewKeyReader(spec *KeyReaderSpec) (*KeyReader, error)
- func (tx *OngoingTx) Set(key []byte, md *KVMetadata, value []byte) error
- func (tx *OngoingTx) WithMetadata(md *TxMetadata) *OngoingTx
- type Options
- func (opts *Options) Validate() error
- func (opts *Options) WithAppFactory(appFactory AppFactoryFunc) *Options
- func (opts *Options) WithCommitLogMaxOpenedFiles(commitLogMaxOpenedFiles int) *Options
- func (opts *Options) WithCompactionDisabled(disabled bool) *Options
- func (opts *Options) WithCompresionLevel(compressionLevel int) *Options
- func (opts *Options) WithCompressionFormat(compressionFormat int) *Options
- func (opts *Options) WithFileMode(fileMode os.FileMode) *Options
- func (opts *Options) WithFileSize(fileSize int) *Options
- func (opts *Options) WithIndexOptions(indexOptions *IndexOptions) *Options
- func (opts *Options) WithLogger(logger logger.Logger) *Options
- func (opts *Options) WithMaxConcurrency(maxConcurrency int) *Options
- func (opts *Options) WithMaxIOConcurrency(maxIOConcurrency int) *Options
- func (opts *Options) WithMaxKeyLen(maxKeyLen int) *Options
- func (opts *Options) WithMaxLinearProofLen(maxLinearProofLen int) *Options
- func (opts *Options) WithMaxTxEntries(maxTxEntries int) *Options
- func (opts *Options) WithMaxValueLen(maxValueLen int) *Options
- func (opts *Options) WithMaxWaitees(maxWaitees int) *Options
- func (opts *Options) WithReadOnly(readOnly bool) *Options
- func (opts *Options) WithSynced(synced bool) *Options
- func (opts *Options) WithTimeFunc(timeFunc TimeFunc) *Options
- func (opts *Options) WithTxLogCacheSize(txLogCacheSize int) *Options
- func (opts *Options) WithTxLogMaxOpenedFiles(txLogMaxOpenedFiles int) *Options
- func (opts *Options) WithVLogMaxOpenedFiles(vLogMaxOpenedFiles int) *Options
- func (opts *Options) WithWriteTxHeaderVersion(version int) *Options
- type Precondition
- type PreconditionKeyMustExist
- type PreconditionKeyMustNotExist
- type PreconditionKeyNotModifiedAfterTx
- type Snapshot
- func (s *Snapshot) Close() error
- func (s *Snapshot) ExistKeyWith(prefix []byte, neq []byte) (bool, error)
- func (s *Snapshot) Get(key []byte) (valRef ValueRef, err error)
- func (s *Snapshot) GetWith(key []byte, filters ...FilterFn) (valRef ValueRef, err error)
- func (s *Snapshot) History(key []byte, offset uint64, descOrder bool, limit int) (tss []uint64, err error)
- func (s *Snapshot) NewKeyReader(spec *KeyReaderSpec) (*KeyReader, error)
- func (s *Snapshot) Ts() uint64
- type TimeFunc
- type Tx
- func (tx *Tx) BuildHashTree() error
- func (tx *Tx) Entries() []*TxEntry
- func (tx *Tx) EntryOf(key []byte) (*TxEntry, error)
- func (tx *Tx) Header() *TxHeader
- func (tx *Tx) IndexOf(key []byte) (int, error)
- func (tx *Tx) Proof(key []byte) (*htree.InclusionProof, error)
- func (tx *Tx) TxEntryDigest() (TxEntryDigest, error)
- type TxEntry
- type TxEntryDigest
- type TxHeader
- type TxMetadata
- type TxReader
- type ValueRef
Constants ¶
const DefaultCommitLogMaxOpenedFiles = 10
const DefaultCompressionFormat = appendable.DefaultCompressionFormat
const DefaultCompressionLevel = appendable.DefaultCompressionLevel
const DefaultFileMode = os.FileMode(0755)
const DefaultFileSize = multiapp.DefaultFileSize
const DefaultMaxConcurrency = 30
const DefaultMaxIOConcurrency = 1
const DefaultMaxKeyLen = 1024
const DefaultMaxLinearProofLen = 1 << 10
const DefaultMaxTxEntries = 1 << 10 // 1024
const DefaultMaxValueLen = 4096 // 4Kb
const DefaultMaxWaitees = 1000
const DefaultTxLogCacheSize = 1000
const DefaultTxLogMaxOpenedFiles = 10
const DefaultVLogMaxOpenedFiles = 10
const DefaultWriteTxHeaderVersion = MaxTxHeaderVersion
const MaxFileSize = (1 << 31) - 1 // 2Gb
const MaxKeyLen = 1024 // assumed to be not lower than hash size
const MaxParallelIO = 127
const MaxTxHeaderVersion = 1
const NotificationWindow = 60 * time.Second
const Version = 1
Variables ¶
var ErrAlreadyClosed = errors.New("already closed")
var ErrCompactionUnsupported = errors.New("compaction is unsupported when remote storage is used")
var ErrCorruptedAHtree = errors.New("appendable hash tree is corrupted")
var ErrCorruptedCLog = errors.New("commit log is corrupted")
var ErrCorruptedData = errors.New("data is corrupted")
var ErrCorruptedIndex = errors.New("corrupted index")
var ErrDuplicatedKey = errors.New("duplicated key")
var ErrExpiredEntry = fmt.Errorf("%w: expired entry", ErrKeyNotFound)
var ErrIllegalArguments = errors.New("illegal arguments")
var ErrIllegalState = tbtree.ErrIllegalState
var ErrInvalidOptions = errors.New("invalid options")
var ErrInvalidPrecondition = errors.New("invalid precondition")
var ErrInvalidPreconditionInvalidTxID = fmt.Errorf("%w: invalid transaction ID", ErrInvalidPrecondition)
var ErrInvalidPreconditionMaxKeyLenExceeded = fmt.Errorf("%w: %v", ErrInvalidPrecondition, ErrorMaxKeyLenExceeded)
var ErrInvalidPreconditionNull = fmt.Errorf("%w: null", ErrInvalidPrecondition)
var ErrInvalidPreconditionNullKey = fmt.Errorf("%w: %v", ErrInvalidPrecondition, ErrNullKey)
var ErrInvalidPreconditionTooMany = fmt.Errorf("%w: too many preconditions", ErrInvalidPrecondition)
var ErrKeyAlreadyExists = errors.New("key already exists")
var ErrKeyNotFound = tbtree.ErrKeyNotFound
var ErrLinearProofMaxLenExceeded = errors.New("max linear proof length limit exceeded")
var ErrMaxConcurrencyLimitExceeded = errors.New("max concurrency limit exceeded")
var ErrMetadataUnsupported = errors.New(
"metadata is unsupported when in 1.1 compatibility mode, " +
"do not use metadata-related features such as expiration and logical deletion",
)
var ErrNewerVersionOrCorruptedData = errors.New("tx created with a newer version or data is corrupted")
var ErrNoMoreEntries = tbtree.ErrNoMoreEntries
var ErrNonExpirable = errors.New("non expirable")
var ErrNullKey = errors.New("null key")
var ErrOffsetOutOfRange = tbtree.ErrOffsetOutOfRange
var ErrPreconditionFailed = errors.New("precondition failed")
var ErrReadOnly = errors.New("read-only")
var ErrSourceTxNewerThanTargetTx = errors.New("source tx is newer than target tx")
var ErrTxNotFound = errors.New("tx not found")
var ErrTxReadConflict = errors.New("tx read conflict")
var ErrTxSizeGreaterThanMaxTxSize = errors.New("tx size greater than max tx size")
var ErrUnexpectedError = errors.New("unexpected error")
var ErrUnexpectedLinkingError = errors.New("internal inconsistency between linear and binary linking")
var ErrUnsupportedTxHeaderVersion = errors.New("missing tx header serialization method")
var ErrUnsupportedTxVersion = errors.New("unsupported tx version")
var ErrWriteOnlyTx = errors.New("write-only transaction")
var ErrorCorruptedTxData = errors.New("tx data is corrupted")
var ErrorMaxKeyLenExceeded = errors.New("max key length exceeded")
var ErrorMaxTxEntriesLimitExceeded = errors.New("max number of entries per tx exceeded")
var ErrorMaxValueLenExceeded = errors.New("max value length exceeded")
var ErrorNoEntriesProvided = errors.New("no entries provided")
var ErrorPathIsNotADirectory = errors.New("path is not a directory")
Functions ¶
func TxEntryDigest_v1_1 ¶ added in v1.2.0
func TxEntryDigest_v1_2 ¶ added in v1.2.0
func VerifyDualProof ¶
func VerifyInclusion ¶ added in v0.9.0
func VerifyLinearProof ¶
Types ¶
type AppFactoryFunc ¶ added in v1.0.5
type AppFactoryFunc func( rootPath string, subPath string, opts *multiapp.Options, ) (appendable.Appendable, error)
type EntrySpec ¶ added in v1.2.0
type EntrySpec struct { Key []byte Metadata *KVMetadata Value []byte }
type EntrySpecDigest ¶ added in v1.2.0
func EntrySpecDigestFor ¶ added in v1.2.0
func EntrySpecDigestFor(version int) (EntrySpecDigest, error)
type FilterFn ¶ added in v1.2.0
filter out entries when filter evaluates to a non-nil error
var ( IgnoreDeleted FilterFn = func(valRef ValueRef, t time.Time) error { md := valRef.KVMetadata() if md != nil && md.Deleted() { return ErrKeyNotFound } return nil } IgnoreExpired FilterFn = func(valRef ValueRef, t time.Time) error { md := valRef.KVMetadata() if md != nil && md.ExpiredAt(t) { return ErrExpiredEntry } return nil } )
type ImmuStore ¶
type ImmuStore struct {
// contains filtered or unexported fields
}
func OpenWith ¶
func OpenWith(path string, vLogs []appendable.Appendable, txLog, cLog appendable.Appendable, opts *Options) (*ImmuStore, error)
func (*ImmuStore) CommitWith ¶ added in v0.9.1
func (*ImmuStore) CompactIndex ¶ added in v0.9.2
func (*ImmuStore) DualProof ¶
DualProof combines linear cryptographic linking i.e. transactions include the linear accumulative hash up to the previous one, with binary cryptographic linking generated by appending the linear accumulative hash values into an incremental hash tree, whose root is also included as part of each transaction and thus considered when calculating the linear accumulative hash. The objective of this proof is the same as the linear proof, that is, generate data for the calculation of the accumulative hash value of the target transaction from the linear accumulative hash value up to source transaction.
func (*ImmuStore) ExistKeyWith ¶ added in v1.0.0
func (*ImmuStore) FlushIndex ¶ added in v1.2.3
func (*ImmuStore) LinearProof ¶
func (s *ImmuStore) LinearProof(sourceTxID, targetTxID uint64) (*LinearProof, error)
LinearProof returns a list of hashes to calculate Alh@targetTxID from Alh@sourceTxID
func (*ImmuStore) MaxConcurrency ¶
func (*ImmuStore) MaxIOConcurrency ¶
func (*ImmuStore) MaxLinearProofLen ¶
func (*ImmuStore) MaxTxEntries ¶
func (*ImmuStore) MaxValueLen ¶
func (*ImmuStore) NewTxHolder ¶ added in v1.2.0
func (*ImmuStore) NewTxReader ¶
func (*ImmuStore) NewWriteOnlyTx ¶ added in v1.2.0
func (*ImmuStore) ReadValue ¶
ReadValue returns the actual associated value to a key at a specific transaction ErrExpiredEntry is be returned if the specified time has already elapsed
func (*ImmuStore) ReplicateTx ¶ added in v1.0.5
func (*ImmuStore) SnapshotSince ¶ added in v0.9.0
func (*ImmuStore) UseTimeFunc ¶ added in v1.1.0
func (*ImmuStore) WaitForIndexingUpto ¶ added in v0.9.2
type IndexOptions ¶
type IndexOptions struct { CacheSize int FlushThld int SyncThld int FlushBufferSize int CleanupPercentage float32 MaxActiveSnapshots int MaxNodeSize int RenewSnapRootAfter time.Duration CompactionThld int DelayDuringCompaction time.Duration NodesLogMaxOpenedFiles int HistoryLogMaxOpenedFiles int CommitLogMaxOpenedFiles int }
func DefaultIndexOptions ¶
func DefaultIndexOptions() *IndexOptions
func (*IndexOptions) Validate ¶ added in v1.2.3
func (opts *IndexOptions) Validate() error
func (*IndexOptions) WithCacheSize ¶
func (opts *IndexOptions) WithCacheSize(cacheSize int) *IndexOptions
func (*IndexOptions) WithCleanupPercentage ¶ added in v1.2.3
func (opts *IndexOptions) WithCleanupPercentage(cleanupPercentage float32) *IndexOptions
func (*IndexOptions) WithCommitLogMaxOpenedFiles ¶ added in v1.2.3
func (opts *IndexOptions) WithCommitLogMaxOpenedFiles(commitLogMaxOpenedFiles int) *IndexOptions
func (*IndexOptions) WithCompactionThld ¶ added in v0.9.2
func (opts *IndexOptions) WithCompactionThld(compactionThld int) *IndexOptions
func (*IndexOptions) WithDelayDuringCompaction ¶ added in v0.9.2
func (opts *IndexOptions) WithDelayDuringCompaction(delayDuringCompaction time.Duration) *IndexOptions
func (*IndexOptions) WithFlushBufferSize ¶ added in v1.2.3
func (opts *IndexOptions) WithFlushBufferSize(flushBufferSize int) *IndexOptions
func (*IndexOptions) WithFlushThld ¶
func (opts *IndexOptions) WithFlushThld(flushThld int) *IndexOptions
func (*IndexOptions) WithHistoryLogMaxOpenedFiles ¶ added in v1.2.3
func (opts *IndexOptions) WithHistoryLogMaxOpenedFiles(historyLogMaxOpenedFiles int) *IndexOptions
func (*IndexOptions) WithMaxActiveSnapshots ¶
func (opts *IndexOptions) WithMaxActiveSnapshots(maxActiveSnapshots int) *IndexOptions
func (*IndexOptions) WithMaxNodeSize ¶
func (opts *IndexOptions) WithMaxNodeSize(maxNodeSize int) *IndexOptions
func (*IndexOptions) WithNodesLogMaxOpenedFiles ¶ added in v1.2.3
func (opts *IndexOptions) WithNodesLogMaxOpenedFiles(nodesLogMaxOpenedFiles int) *IndexOptions
func (*IndexOptions) WithRenewSnapRootAfter ¶
func (opts *IndexOptions) WithRenewSnapRootAfter(renewSnapRootAfter time.Duration) *IndexOptions
func (*IndexOptions) WithSyncThld ¶ added in v1.2.3
func (opts *IndexOptions) WithSyncThld(syncThld int) *IndexOptions
type KVMetadata ¶ added in v1.2.0
type KVMetadata struct {
// contains filtered or unexported fields
}
func NewKVMetadata ¶ added in v1.2.0
func NewKVMetadata() *KVMetadata
func (*KVMetadata) AsDeleted ¶ added in v1.2.0
func (md *KVMetadata) AsDeleted(deleted bool) error
func (*KVMetadata) AsNonIndexable ¶ added in v1.2.3
func (md *KVMetadata) AsNonIndexable(nonIndexable bool) error
func (*KVMetadata) Bytes ¶ added in v1.2.0
func (md *KVMetadata) Bytes() []byte
func (*KVMetadata) Deleted ¶ added in v1.2.0
func (md *KVMetadata) Deleted() bool
func (*KVMetadata) ExpirationTime ¶ added in v1.2.0
func (md *KVMetadata) ExpirationTime() (time.Time, error)
func (*KVMetadata) ExpiredAt ¶ added in v1.2.0
func (md *KVMetadata) ExpiredAt(mtime time.Time) bool
func (*KVMetadata) ExpiresAt ¶ added in v1.2.0
func (md *KVMetadata) ExpiresAt(expiresAt time.Time) error
func (*KVMetadata) IsExpirable ¶ added in v1.2.0
func (md *KVMetadata) IsExpirable() bool
func (*KVMetadata) NonExpirable ¶ added in v1.2.0
func (md *KVMetadata) NonExpirable() *KVMetadata
func (*KVMetadata) NonIndexable ¶ added in v1.2.3
func (md *KVMetadata) NonIndexable() bool
type KeyReader ¶ added in v0.9.1
type KeyReader struct {
// contains filtered or unexported fields
}
func (*KeyReader) ReadAsBefore ¶ added in v1.0.0
type KeyReaderSpec ¶ added in v1.0.0
type LinearProof ¶
type NotificationType ¶ added in v0.9.2
type NotificationType = int
const ( Info NotificationType = iota Warn Error )
type OngoingTx ¶ added in v1.2.0
type OngoingTx struct {
// contains filtered or unexported fields
}
OngoingTx (no-thread safe) represents an interactive or incremental transaction with support of RYOW. The snapshot may be locally modified but isolated from other transactions
func (*OngoingTx) AddPrecondition ¶ added in v1.2.3
func (tx *OngoingTx) AddPrecondition(c Precondition) error
func (*OngoingTx) AsyncCommit ¶ added in v1.2.0
func (*OngoingTx) ExistKeyWith ¶ added in v1.2.0
func (*OngoingTx) IsWriteOnly ¶ added in v1.2.0
func (*OngoingTx) Metadata ¶ added in v1.2.0
func (tx *OngoingTx) Metadata() *TxMetadata
func (*OngoingTx) NewKeyReader ¶ added in v1.2.0
func (tx *OngoingTx) NewKeyReader(spec *KeyReaderSpec) (*KeyReader, error)
func (*OngoingTx) Set ¶ added in v1.2.0
func (tx *OngoingTx) Set(key []byte, md *KVMetadata, value []byte) error
func (*OngoingTx) WithMetadata ¶ added in v1.2.0
func (tx *OngoingTx) WithMetadata(md *TxMetadata) *OngoingTx
type Options ¶
type Options struct { ReadOnly bool Synced bool FileMode os.FileMode CompactionDisabled bool MaxConcurrency int MaxIOConcurrency int MaxLinearProofLen int TxLogCacheSize int VLogMaxOpenedFiles int TxLogMaxOpenedFiles int CommitLogMaxOpenedFiles int WriteTxHeaderVersion int MaxWaitees int TimeFunc TimeFunc // options below are only set during initialization and stored as metadata MaxTxEntries int MaxKeyLen int MaxValueLen int FileSize int CompressionFormat int CompressionLevel int // options below affect indexing IndexOpts *IndexOptions // 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) WithCommitLogMaxOpenedFiles ¶
func (*Options) WithCompactionDisabled ¶ added in v1.0.5
func (*Options) WithCompresionLevel ¶
func (*Options) WithCompressionFormat ¶
func (*Options) WithFileSize ¶
func (*Options) WithIndexOptions ¶
func (opts *Options) WithIndexOptions(indexOptions *IndexOptions) *Options
func (*Options) WithLogger ¶ added in v1.2.4
func (*Options) WithMaxConcurrency ¶
func (*Options) WithMaxIOConcurrency ¶
func (*Options) WithMaxKeyLen ¶
func (*Options) WithMaxLinearProofLen ¶
func (*Options) WithMaxTxEntries ¶
func (*Options) WithMaxValueLen ¶
func (*Options) WithMaxWaitees ¶ added in v0.9.2
func (*Options) WithReadOnly ¶
func (*Options) WithSynced ¶
func (*Options) WithTimeFunc ¶ added in v1.1.0
func (*Options) WithTxLogCacheSize ¶ added in v0.9.2
func (*Options) WithTxLogMaxOpenedFiles ¶
func (*Options) WithVLogMaxOpenedFiles ¶
func (*Options) WithWriteTxHeaderVersion ¶ added in v1.2.3
type Precondition ¶ added in v1.2.3
type PreconditionKeyMustExist ¶ added in v1.2.3
type PreconditionKeyMustExist struct {
Key []byte
}
func (*PreconditionKeyMustExist) Check ¶ added in v1.2.3
func (cs *PreconditionKeyMustExist) Check(idx KeyIndex) (bool, error)
func (*PreconditionKeyMustExist) String ¶ added in v1.2.3
func (cs *PreconditionKeyMustExist) String() string
func (*PreconditionKeyMustExist) Validate ¶ added in v1.2.3
func (cs *PreconditionKeyMustExist) Validate(st *ImmuStore) error
type PreconditionKeyMustNotExist ¶ added in v1.2.3
type PreconditionKeyMustNotExist struct {
Key []byte
}
func (*PreconditionKeyMustNotExist) Check ¶ added in v1.2.3
func (cs *PreconditionKeyMustNotExist) Check(idx KeyIndex) (bool, error)
func (*PreconditionKeyMustNotExist) String ¶ added in v1.2.3
func (cs *PreconditionKeyMustNotExist) String() string
func (*PreconditionKeyMustNotExist) Validate ¶ added in v1.2.3
func (cs *PreconditionKeyMustNotExist) Validate(st *ImmuStore) error
type PreconditionKeyNotModifiedAfterTx ¶ added in v1.2.3
func (*PreconditionKeyNotModifiedAfterTx) Check ¶ added in v1.2.3
func (cs *PreconditionKeyNotModifiedAfterTx) Check(idx KeyIndex) (bool, error)
func (*PreconditionKeyNotModifiedAfterTx) String ¶ added in v1.2.3
func (cs *PreconditionKeyNotModifiedAfterTx) String() string
func (*PreconditionKeyNotModifiedAfterTx) Validate ¶ added in v1.2.3
func (cs *PreconditionKeyNotModifiedAfterTx) Validate(st *ImmuStore) error
type Snapshot ¶ added in v1.0.0
type Snapshot struct {
// contains filtered or unexported fields
}
func (*Snapshot) ExistKeyWith ¶ added in v1.2.0
func (*Snapshot) NewKeyReader ¶ added in v1.0.0
func (s *Snapshot) NewKeyReader(spec *KeyReaderSpec) (*KeyReader, error)
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
func NewTxWithEntries ¶ added in v0.9.0
func (*Tx) BuildHashTree ¶ added in v0.9.0
func (*Tx) TxEntryDigest ¶ added in v1.2.0
func (tx *Tx) TxEntryDigest() (TxEntryDigest, error)
type TxEntry ¶ added in v0.9.1
type TxEntry struct {
// contains filtered or unexported fields
}
func NewTxEntry ¶ added in v0.9.1
func (*TxEntry) Metadata ¶ added in v1.2.0
func (e *TxEntry) Metadata() *KVMetadata
type TxHeader ¶ added in v1.2.0
type TxHeader struct { ID uint64 Ts int64 BlTxID uint64 BlRoot [sha256.Size]byte PrevAlh [sha256.Size]byte Version int Metadata *TxMetadata NEntries int Eh [sha256.Size]byte }
type TxMetadata ¶
type TxMetadata struct { }
func NewTxMetadata ¶ added in v1.2.0
func NewTxMetadata() *TxMetadata
func (*TxMetadata) Bytes ¶ added in v1.2.0
func (md *TxMetadata) Bytes() []byte
func (*TxMetadata) Equal ¶ added in v1.2.0
func (md *TxMetadata) Equal(amd *TxMetadata) bool
func (*TxMetadata) ReadFrom ¶ added in v1.2.0
func (md *TxMetadata) ReadFrom(b []byte) error