rocksdb #29
8
db/db.go
|
@ -117,6 +117,7 @@ func (pr *PrefixRow) Iter(options *IterOptions) <-chan *PrefixRowKV {
|
|||
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
|
||||
var prevKey []byte = nil
|
||||
go func() {
|
||||
defer it.Close()
|
||||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
for ; terminateFunc(prevKey); it.Next() {
|
||||
key := it.Key()
|
||||
prevKey = key.Data()
|
||||
|
@ -260,11 +261,12 @@ func OpenDB(name string) int {
|
|||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
// Read db
|
||||
opts := grocksdb.NewDefaultOptions()
|
||||
db, err := grocksdb.OpenDb(opts, name)
|
||||
ro := grocksdb.NewDefaultReadOptions()
|
||||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
ro.SetFillCache(false)
|
||||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
defer db.Close()
|
||||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
ro := grocksdb.NewDefaultReadOptions()
|
||||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
ro.SetFillCache(false)
|
||||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
|
||||
log.Println(db.Name())
|
||||
|
||||
|
@ -277,7 +279,7 @@ func OpenDB(name string) int {
|
|||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
key := it.Key()
|
||||
value := it.Value()
|
||||
|
||||
fmt.Printf("Key: %v Value: %v\n", key.Data(), value.Data())
|
||||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
fmt.Printf("Key: %v Value: %v\n", hex.EncodeToString(key.Data()), hex.EncodeToString(value.Data()))
|
||||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
||||
|
||||
key.Free()
|
||||
value.Free()
|
||||
|
|
|||
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
![]() no need to start these with N no need to start these with N
![]() and many of these are unused and many of these are unused
![]() is this really no big deal? seems like an error to me but idk rocksdb is this really no big deal? seems like an error to me but idk rocksdb
![]() typo: Famlies -> Families typo: Famlies -> Families
![]() this can be unexported this can be unexported
![]() still need this? still need this?
![]() typo typo
![]() 👀 :eyes:
![]() I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation. I agree the "N" can go. I copied these all over from the Python. where I believe they are similarly unused, because I thought it might be the defacto documentation.
![]()
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this. ```
// Valid returns false only when an Iterator has iterated past either the
// first or the last key in the database.
func (iter *Iterator) Valid() bool {
return C.rocksdb_iter_valid(iter.c) != 0
}
```
If our iterator was to try to go off the end of the db, or the front if we're going backwards, we need to check this.
|
|
@ -27,6 +27,7 @@ func TestReadUTXO2(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("err not nil: %+v\n", err)
|
||||
}
|
||||
defer db.Close()
|
||||
utxoRow := &PrefixRow{
|
||||
// KeyStruct: UTXOKey{},
|
||||
// ValueStruct: UTXOValue{},
|
||||
|
@ -62,9 +63,6 @@ func TestReadUTXO2(t *testing.T) {
|
|||
t.Errorf("got: %d, want: %d\n", got, tt.want)
|
||||
}
|
||||
i++
|
||||
if i >= 10 {
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -89,6 +87,8 @@ func TestReadUTXO(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("err not nil: %+v\n", err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
data := ReadPrefixN(db, prefixes.UTXO, tt.want)
|
||||
|
||||
got := len(data)
|
||||
|
@ -147,13 +147,13 @@ func TestUTXOKey_String(t *testing.T) {
|
|||
hashx: []byte("AAAAAAAAAA"),
|
||||
txnum: 0,
|
||||
nout: 0,
|
||||
want: "db.UTXOKey(hashX=41414141414141414141, tx_num=0, nout=0)",
|
||||
want: "*db.UTXOKey(hashX=41414141414141414141, tx_num=0, nout=0)",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
key := UTXOKey{
|
||||
key := &UTXOKey{
|
||||
Prefix: tt.prefix,
|
||||
HashX: tt.hashx,
|
||||
TxNum: tt.txnum,
|
||||
|
|
35
server/args_test.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
pb "github.com/lbryio/hub/protobuf/go"
|
||||
)
|
||||
|
||||
// TestParseArgs
|
||||
func TestParseArgs(t *testing.T) {
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "Correctly disables elastic search",
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
os.Args = []string{"serve", "--disable-es"}
|
||||
searchRequest := new(pb.SearchRequest)
|
||||
args := ParseArgs(searchRequest)
|
||||
got := args.DisableEs
|
||||
if got != tt.want {
|
||||
t.Errorf("flags: got: %v, want: %v\n", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
no need to start these with N
and many of these are unused
is this really no big deal? seems like an error to me but idk rocksdb
typo: Famlies -> Families
this can be unexported
still need this?
typo
👀