Module: Immudb::Schema

Defined in:
lib/immudb/schema.rb,
lib/immudb/grpc/schema_pb.rb,
lib/immudb/grpc/schema_services_pb.rb

Defined Under Namespace

Modules: ImmuService

Constant Summary collapse

Key =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Key").msgclass
Permission =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Permission").msgclass
User =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.User").msgclass
UserList =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UserList").msgclass
CreateUserRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.CreateUserRequest").msgclass
UserRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UserRequest").msgclass
ChangePasswordRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ChangePasswordRequest").msgclass
LoginRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.LoginRequest").msgclass
LoginResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.LoginResponse").msgclass
AuthConfig =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.AuthConfig").msgclass
MTLSConfig =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.MTLSConfig").msgclass
OpenSessionRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.OpenSessionRequest").msgclass
OpenSessionResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.OpenSessionResponse").msgclass
Precondition =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Precondition").msgclass
KeyValue =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.KeyValue").msgclass
Entry =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Entry").msgclass
Reference =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Reference").msgclass
Op =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Op").msgclass
ExecAllRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ExecAllRequest").msgclass
Entries =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Entries").msgclass
ZEntry =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ZEntry").msgclass
ZEntries =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ZEntries").msgclass
ScanRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ScanRequest").msgclass
KeyPrefix =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.KeyPrefix").msgclass
EntryCount =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.EntryCount").msgclass
Signature =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Signature").msgclass
TxHeader =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxHeader").msgclass
TxMetadata =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxMetadata").msgclass
LinearProof =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.LinearProof").msgclass
DualProof =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DualProof").msgclass
Tx =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Tx").msgclass
TxEntry =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxEntry").msgclass
KVMetadata =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.KVMetadata").msgclass
Expiration =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Expiration").msgclass
VerifiableTx =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableTx").msgclass
VerifiableEntry =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableEntry").msgclass
InclusionProof =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.InclusionProof").msgclass
SetRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SetRequest").msgclass
KeyRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.KeyRequest").msgclass
KeyListRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.KeyListRequest").msgclass
DeleteKeysRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DeleteKeysRequest").msgclass
VerifiableSetRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableSetRequest").msgclass
VerifiableGetRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableGetRequest").msgclass
HealthResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.HealthResponse").msgclass
DatabaseHealthResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DatabaseHealthResponse").msgclass
ImmutableState =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ImmutableState").msgclass
ReferenceRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ReferenceRequest").msgclass
VerifiableReferenceRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableReferenceRequest").msgclass
ZAddRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ZAddRequest").msgclass
Score =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Score").msgclass
ZScanRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ZScanRequest").msgclass
HistoryRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.HistoryRequest").msgclass
VerifiableZAddRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableZAddRequest").msgclass
TxRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxRequest").msgclass
EntriesSpec =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.EntriesSpec").msgclass
EntryTypeSpec =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.EntryTypeSpec").msgclass
VerifiableTxRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableTxRequest").msgclass
TxScanRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxScanRequest").msgclass
TxList =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxList").msgclass
ExportTxRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ExportTxRequest").msgclass
Database =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Database").msgclass
DatabaseSettings =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DatabaseSettings").msgclass
CreateDatabaseRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.CreateDatabaseRequest").msgclass
CreateDatabaseResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.CreateDatabaseResponse").msgclass
UpdateDatabaseRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UpdateDatabaseRequest").msgclass
UpdateDatabaseResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UpdateDatabaseResponse").msgclass
DatabaseSettingsRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DatabaseSettingsRequest").msgclass
DatabaseSettingsResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DatabaseSettingsResponse").msgclass
NullableUint32 =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.NullableUint32").msgclass
NullableUint64 =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.NullableUint64").msgclass
NullableFloat =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.NullableFloat").msgclass
NullableBool =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.NullableBool").msgclass
NullableString =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.NullableString").msgclass
DatabaseNullableSettings =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DatabaseNullableSettings").msgclass
ReplicationNullableSettings =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ReplicationNullableSettings").msgclass
IndexNullableSettings =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.IndexNullableSettings").msgclass
LoadDatabaseRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.LoadDatabaseRequest").msgclass
LoadDatabaseResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.LoadDatabaseResponse").msgclass
UnloadDatabaseRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UnloadDatabaseRequest").msgclass
UnloadDatabaseResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UnloadDatabaseResponse").msgclass
DeleteDatabaseRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DeleteDatabaseRequest").msgclass
DeleteDatabaseResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DeleteDatabaseResponse").msgclass
FlushIndexRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.FlushIndexRequest").msgclass
FlushIndexResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.FlushIndexResponse").msgclass
Table =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Table").msgclass
SQLGetRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLGetRequest").msgclass
VerifiableSQLGetRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableSQLGetRequest").msgclass
SQLEntry =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLEntry").msgclass
VerifiableSQLEntry =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableSQLEntry").msgclass
UseDatabaseReply =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UseDatabaseReply").msgclass
ChangePermissionRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ChangePermissionRequest").msgclass
SetActiveUserRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SetActiveUserRequest").msgclass
DatabaseListResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DatabaseListResponse").msgclass
DatabaseListRequestV2 =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DatabaseListRequestV2").msgclass
DatabaseListResponseV2 =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DatabaseListResponseV2").msgclass
DatabaseWithSettings =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DatabaseWithSettings").msgclass
Chunk =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Chunk").msgclass
UseSnapshotRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UseSnapshotRequest").msgclass
SQLExecRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLExecRequest").msgclass
SQLQueryRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLQueryRequest").msgclass
NamedParam =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.NamedParam").msgclass
SQLExecResult =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLExecResult").msgclass
CommittedSQLTx =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.CommittedSQLTx").msgclass
SQLQueryResult =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLQueryResult").msgclass
Column =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Column").msgclass
Row =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Row").msgclass
SQLValue =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLValue").msgclass
NewTxRequest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.NewTxRequest").msgclass
NewTxResponse =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.NewTxResponse").msgclass
ErrorInfo =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ErrorInfo").msgclass
DebugInfo =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DebugInfo").msgclass
RetryInfo =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.RetryInfo").msgclass
EntryTypeAction =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.EntryTypeAction").enummodule
PermissionAction =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.PermissionAction").enummodule
TxMode =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxMode").enummodule

Class Method Summary collapse

Class Method Details

.digest_from_proto(sliced_digest) ⇒ Object



110
111
112
# File 'lib/immudb/schema.rb', line 110

def digest_from_proto(sliced_digest)
  sliced_digest[0, 32]
end

.digests_from_proto(sliced_terms) ⇒ Object



114
115
116
# File 'lib/immudb/schema.rb', line 114

def digests_from_proto(sliced_terms)
  sliced_terms.map(&:dup)
end

.dual_proof_from_proto(dproof) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/immudb/schema.rb', line 71

def dual_proof_from_proto(dproof)
  dp = ::Immudb::DualProof.new
  dp.sourceTxHeader = tx_header_from_proto(dproof.sourceTxHeader)
  dp.targetTxHeader = tx_header_from_proto(dproof.targetTxHeader)
  dp.inclusionProof = digests_from_proto(dproof.inclusionProof)
  dp.consistencyProof = digests_from_proto(dproof.consistencyProof)
  dp.targetBlTxAlh = digest_from_proto(dproof.targetBlTxAlh)
  dp.lastInclusionProof = digests_from_proto(dproof.lastInclusionProof)
  dp.linearProof = linear_proof_from_proto(dproof.linearProof)
  dp
end

.inclusion_proof_from_proto(iproof) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/immudb/schema.rb', line 63

def inclusion_proof_from_proto(iproof)
  ip = ::Immudb::InclusionProof.new
  ip.leaf = iproof.leaf.to_i
  ip.width = iproof.width.to_i
  ip.terms = digests_from_proto(iproof.terms)
  ip
end

.kv_metadata_from_proto(md) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/immudb/schema.rb', line 49

def (md)
  return nil if md.nil?
  kvmd = ::Immudb::KVMetadata.new()
  kvmd.as_deleted(md.deleted)

  unless md.expiration.nil?
    kvmd.expires_at(Time.at(md.expiration.expiresAt))
  end

  kvmd.as_non_indexable(md.nonIndexable)

  kvmd
end

.linear_proof_from_proto(lproof) ⇒ Object



102
103
104
105
106
107
108
# File 'lib/immudb/schema.rb', line 102

def linear_proof_from_proto(lproof)
  lp = ::Immudb::LinearProof.new
  lp.sourceTxID = lproof.sourceTxId
  lp.targetTxID = lproof.TargetTxId
  lp.terms = digests_from_proto(lproof.terms)
  lp
end

.tx_from_proto(stx) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/immudb/schema.rb', line 16

def tx_from_proto(stx)
  header = ::Immudb::TxHeader.new
  header.iD = stx.header.id
  header.ts = stx.header.ts
  header.blTxID = stx.header.blTxId
  header.blRoot = digest_from_proto(stx.header.blRoot)
  header.prevAlh = digest_from_proto(stx.header.prevAlh)

  header.version = stx.header.version.to_i
  header. = (stx.header.)

  header.nentries = stx.header.nentries.to_i
  header.eh = digest_from_proto(stx.header.eH)

  entries = []
  stx.entries.each do |e|
    entries <<
      ::Immudb::TxEntry.new(
        e.key,
        (e.),
        e.vLen.to_i,
        digest_from_proto(e.hValue),
        0
      )
  end

  tx = Store.new_tx_with_entries(header, entries)

  tx.build_hash_tree

  tx
end

.tx_header_from_proto(hdr) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/immudb/schema.rb', line 83

def tx_header_from_proto(hdr)
  txh = ::Immudb::TxHeader.new
  txh.iD = hdr.id
  txh.prevAlh = digest_from_proto(hdr.prevAlh)
  txh.ts = hdr.ts
  txh.version = hdr.version.to_i
  txh. = (hdr.)
  txh.nentries = hdr.nentries.to_i
  txh.eh = digest_from_proto(hdr.eH)
  txh.blTxID = hdr.blTxId
  txh.blRoot = digest_from_proto(hdr.blRoot)
  txh
end

.tx_metadata_from_proto(md) ⇒ Object



97
98
99
100
# File 'lib/immudb/schema.rb', line 97

def (md)
  return nil if md.nil?
  ::Immudb::TxMetadata.new
end