2023-09-12 18:44:45 +00:00
|
|
|
# nimbus-eth1
|
2024-05-07 19:59:27 +00:00
|
|
|
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
2023-09-12 18:44:45 +00:00
|
|
|
# Licensed under either of
|
|
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
|
|
# http://opensource.org/licenses/MIT)
|
|
|
|
# at your option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
|
|
|
## Kvt DB -- structural data types
|
|
|
|
## ===============================
|
|
|
|
##
|
|
|
|
{.push raises: [].}
|
|
|
|
|
|
|
|
import
|
|
|
|
std/tables,
|
|
|
|
eth/common
|
|
|
|
|
|
|
|
type
|
2024-05-07 19:59:27 +00:00
|
|
|
LayerDeltaRef* = ref object
|
2023-12-19 12:39:23 +00:00
|
|
|
## Delta tables relative to previous layer
|
|
|
|
sTab*: Table[Blob,Blob] ## Structural data table
|
|
|
|
|
2023-09-12 18:44:45 +00:00
|
|
|
LayerRef* = ref object
|
|
|
|
## Kvt database layer structures. Any layer holds the full
|
|
|
|
## change relative to the backend.
|
2024-05-07 19:59:27 +00:00
|
|
|
delta*: LayerDeltaRef ## Structural tables held as deltas
|
2023-09-12 18:44:45 +00:00
|
|
|
txUid*: uint ## Transaction identifier if positive
|
|
|
|
|
2024-05-07 19:59:27 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Public helpers (misc)
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
func init*(T: type LayerRef): T =
|
|
|
|
## Constructor, returns empty layer
|
|
|
|
T(delta: LayerDeltaRef())
|
|
|
|
|
|
|
|
func dup*(ly: LayerDeltaRef): LayerDeltaRef =
|
|
|
|
## Duplicate/copy
|
|
|
|
LayerDeltaRef(sTab: ly.sTab)
|
|
|
|
|
2023-09-12 18:44:45 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# End
|
|
|
|
# ------------------------------------------------------------------------------
|