Skip to content

InMemoryNodeStorage

ratranqu edited this page Apr 7, 2021 · 2 revisions

InMemoryNodeStorage

public final class InMemoryNodeStorage<Key: Comparable & Codable & DataProtocol & InitialisableProtocol, Value: Codable & DataProtocol & InitialisableProtocol, Hasher: HasherProtocol>: NodeStorageProtocol

Inheritance

NodeStorageProtocol

Nested Type Aliases

Key

public typealias Key = Key

Value

public typealias Value = Value

Hasher

public typealias Hasher = Hasher

Hash

public typealias Hash = Hasher.Hash

Node

public typealias Node = InMemoryNode<Key, Value, Hasher>

Initializers

init()

public init()

init(_:_:)

public init(_ root: Node, _ version: Int64)

Properties

orphans

var orphans: [Hash: Int64] = [:]

version

var version: Int64 = 0

versions

var versions: [Int64]

description

var description: String

Methods

root(at:)

public func root(at version: Int64) throws -> InMemoryNode<Key, Value, Hasher>?

rollback()

public func rollback()

set(key:value:)

@discardableResult public func set(key: Key, value: Value) throws -> Bool

remove(key:)

@discardableResult public func remove(key: Key) -> (Value?, Bool)

deleteLast()

public func deleteLast() throws

deleteAll(from:)

public func deleteAll(from: Int64) throws

commit()

public func commit() throws

makeEmpty()

public func makeEmpty() -> InMemoryNode<Key, Value, Hasher>

makeLeaf(key:value:)

public func makeLeaf(key: Key, value: Value) -> Node

makeInner(key:left:right:)

public func makeInner(key: Key, left: Node, right: Node) -> Node