Commit 991910d2 authored by Praful Nalatwad's avatar Praful Nalatwad
Browse files

immudb version upgrade, added sync functionality, close session in TestDbConnection.

parent ed14a167
Branches
Tags
3 merge requests!270Core ImmuDB package and TOTP plugin - Implementation,!269Core ImmuDB package and TOTP plugin - Implementation,!268immudb version upgrade
Showing with 76 additions and 673 deletions
......@@ -47,7 +47,8 @@ type ImmuDAO struct {
MetaData MetaData
}
type MetaData struct {
GetOpts GetOptions
GetOpts GetOptions
ScanOpts schema.ScanRequest
}
type GetOptions struct {
AtTx uint64 `json:"atTx"`
......@@ -215,6 +216,7 @@ func TestDbConnection(host ImmuHost) error {
if err != nil {
return err
}
defer client.CloseSession(context.TODO())
if ok := client.IsConnected(); !ok {
return errormdl.Wrap("ImmuDB is not connected")
}
......@@ -343,6 +345,30 @@ func (i *ImmuDAO) GetKeyHistory(key []byte, offset uint64, limit int32, desc boo
return client.History(context.TODO(), req)
}
// GetActiveKeys - List all avaliable keys from active database, this function does not retrive deleted keys
/*
This call can have below options:-
SeekKey - List all keys which were inserted/saved after the specified key, include specified key in result if InclusiveSeek = True
EndKey - List all keys which were inserted/saved before the specified key, include specified key in result if InclusiveEnd = True
Prefix - List all keys which are perfixed with given character(s)
Desc - Sorting in descending order
Limit - Maximum numbers of entries to return
SinceTx - Used to avoid waiting for the indexer to be up-to-date with the most recent transaction
NoWait (True/False) - If set to true, then the server will not wait for the indexer to be up-to-date with the most recent transaction
InclusiveSeek (True/False)
InclusiveEnd (True/False)
Offset - Number of entries to skip
*/
func (i *ImmuDAO) GetActiveKeys() (*schema.Entries, error) {
client, err := GetImmuDbConnection(i.HostName) // ImmuDB connection
if err != nil {
return nil, err
}
// Scan iterates over the set of keys in a topological order
return client.Scan(context.TODO(), &i.MetaData.ScanOpts)
}
/* END OF READ OPERATIONS */
/* WRITE OPERATIONS */
......
......@@ -9,7 +9,7 @@ require (
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/aymerick/raymond v2.0.2+incompatible
github.com/boltdb/bolt v1.3.1
github.com/codenotary/immudb v1.4.1
github.com/codenotary/immudb v1.5.0
github.com/denisenkom/go-mssqldb v0.12.2
github.com/dgraph-io/dgo/v2 v2.2.0
github.com/dgrijalva/jwt-go v3.2.0+incompatible
......@@ -33,7 +33,7 @@ require (
github.com/qiangxue/fasthttp-routing v0.0.0-20160225050629-6ccdc2a18d87
github.com/segmentio/ksuid v1.0.4
github.com/shurcooL/go-goon v1.0.0
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.2
github.com/tidwall/buntdb v1.2.9
github.com/tidwall/gjson v1.14.1
github.com/tidwall/sjson v1.2.4
......@@ -41,8 +41,8 @@ require (
github.com/zhouzhuojie/conditions v0.2.3
go.mongodb.org/mongo-driver v1.9.1
go.uber.org/zap v1.21.0
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
google.golang.org/grpc v1.54.0
golang.org/x/crypto v0.10.0
google.golang.org/grpc v1.56.1
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gopkg.in/natefinch/lumberjack.v2 v2.0.0
......@@ -93,10 +93,10 @@ require (
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
......@@ -116,13 +116,15 @@ require (
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/term v0.7.0 // indirect
golang.org/x/text v0.8.0 // indirect
google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd // indirect
google.golang.org/protobuf v1.30.0 // indirect
golang.org/x/net v0.11.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/term v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
google.golang.org/genproto v0.0.0-20230626202813-9b080da550b3 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230626202813-9b080da550b3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230626202813-9b080da550b3 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
......
This diff is collapsed.
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment