rocksdb #29

Merged
jeffreypicard merged 93 commits from feature/27/jeffreypicard/rocksdb into master 2022-04-29 17:04:01 +02:00
5 changed files with 23 additions and 6 deletions
Showing only changes of commit f9011c7d52 - Show all commits

View file

@ -332,8 +332,10 @@ func IterCF(db *grocksdb.DB, opts *IterOptions) <-chan *prefixes.PrefixRowKV {
lyoshenka commented 2022-03-24 22:26:17 +01:00 (Migrated from github.com)
Review

no need to start these with N

no need to start these with N
lyoshenka commented 2022-03-24 22:26:38 +01:00 (Migrated from github.com)
Review

and many of these are unused

and many of these are unused
lyoshenka commented 2022-03-24 22:34:50 +01:00 (Migrated from github.com)
Review

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
lyoshenka commented 2022-03-24 22:38:01 +01:00 (Migrated from github.com)
Review

typo: Famlies -> Families

typo: Famlies -> Families
lyoshenka commented 2022-03-24 22:41:04 +01:00 (Migrated from github.com)
Review

this can be unexported

this can be unexported
lyoshenka commented 2022-03-24 22:41:39 +01:00 (Migrated from github.com)
Review

still need this?

still need this?
lyoshenka commented 2022-03-24 22:43:06 +01:00 (Migrated from github.com)
Review

typo

typo
lyoshenka commented 2022-03-24 22:43:32 +01:00 (Migrated from github.com)
Review

👀

:eyes:
jeffreypicard commented 2022-03-24 23:32:48 +01:00 (Migrated from github.com)
Review

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.
jeffreypicard commented 2022-03-24 23:39:47 +01:00 (Migrated from github.com)
Review
// 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.

``` // 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.
lyoshenka commented 2022-03-24 22:26:17 +01:00 (Migrated from github.com)
Review

no need to start these with N

no need to start these with N
lyoshenka commented 2022-03-24 22:26:38 +01:00 (Migrated from github.com)
Review

and many of these are unused

and many of these are unused
lyoshenka commented 2022-03-24 22:34:50 +01:00 (Migrated from github.com)
Review

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
lyoshenka commented 2022-03-24 22:38:01 +01:00 (Migrated from github.com)
Review

typo: Famlies -> Families

typo: Famlies -> Families
lyoshenka commented 2022-03-24 22:41:04 +01:00 (Migrated from github.com)
Review

this can be unexported

this can be unexported
lyoshenka commented 2022-03-24 22:41:39 +01:00 (Migrated from github.com)
Review

still need this?

still need this?
lyoshenka commented 2022-03-24 22:43:06 +01:00 (Migrated from github.com)
Review

typo

typo
lyoshenka commented 2022-03-24 22:43:32 +01:00 (Migrated from github.com)
Review

👀

:eyes:
jeffreypicard commented 2022-03-24 23:32:48 +01:00 (Migrated from github.com)
Review

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.
jeffreypicard commented 2022-03-24 23:39:47 +01:00 (Migrated from github.com)
Review
// 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.

``` // 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.
} }
go func() { go func() {
defer it.Close() defer func() {
lyoshenka commented 2022-03-24 22:26:17 +01:00 (Migrated from github.com)
Review

no need to start these with N

no need to start these with N
lyoshenka commented 2022-03-24 22:26:38 +01:00 (Migrated from github.com)
Review

and many of these are unused

and many of these are unused
lyoshenka commented 2022-03-24 22:34:50 +01:00 (Migrated from github.com)
Review

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
lyoshenka commented 2022-03-24 22:38:01 +01:00 (Migrated from github.com)
Review

typo: Famlies -> Families

typo: Famlies -> Families
lyoshenka commented 2022-03-24 22:41:04 +01:00 (Migrated from github.com)
Review

this can be unexported

this can be unexported
lyoshenka commented 2022-03-24 22:41:39 +01:00 (Migrated from github.com)
Review

still need this?

still need this?
lyoshenka commented 2022-03-24 22:43:06 +01:00 (Migrated from github.com)
Review

typo

typo
lyoshenka commented 2022-03-24 22:43:32 +01:00 (Migrated from github.com)
Review

👀

:eyes:
jeffreypicard commented 2022-03-24 23:32:48 +01:00 (Migrated from github.com)
Review

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.
jeffreypicard commented 2022-03-24 23:39:47 +01:00 (Migrated from github.com)
Review
// 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.

``` // 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.
lyoshenka commented 2022-03-24 22:26:17 +01:00 (Migrated from github.com)
Review

no need to start these with N

no need to start these with N
lyoshenka commented 2022-03-24 22:26:38 +01:00 (Migrated from github.com)
Review

and many of these are unused

and many of these are unused
lyoshenka commented 2022-03-24 22:34:50 +01:00 (Migrated from github.com)
Review

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
lyoshenka commented 2022-03-24 22:38:01 +01:00 (Migrated from github.com)
Review

typo: Famlies -> Families

typo: Famlies -> Families
lyoshenka commented 2022-03-24 22:41:04 +01:00 (Migrated from github.com)
Review

this can be unexported

this can be unexported
lyoshenka commented 2022-03-24 22:41:39 +01:00 (Migrated from github.com)
Review

still need this?

still need this?
lyoshenka commented 2022-03-24 22:43:06 +01:00 (Migrated from github.com)
Review

typo

typo
lyoshenka commented 2022-03-24 22:43:32 +01:00 (Migrated from github.com)
Review

👀

:eyes:
jeffreypicard commented 2022-03-24 23:32:48 +01:00 (Migrated from github.com)
Review

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.
jeffreypicard commented 2022-03-24 23:39:47 +01:00 (Migrated from github.com)
Review
// 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.

``` // 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.
defer close(ch) it.Close()
lyoshenka commented 2022-03-24 22:26:17 +01:00 (Migrated from github.com)
Review

no need to start these with N

no need to start these with N
lyoshenka commented 2022-03-24 22:26:38 +01:00 (Migrated from github.com)
Review

and many of these are unused

and many of these are unused
lyoshenka commented 2022-03-24 22:34:50 +01:00 (Migrated from github.com)
Review

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
lyoshenka commented 2022-03-24 22:38:01 +01:00 (Migrated from github.com)
Review

typo: Famlies -> Families

typo: Famlies -> Families
lyoshenka commented 2022-03-24 22:41:04 +01:00 (Migrated from github.com)
Review

this can be unexported

this can be unexported
lyoshenka commented 2022-03-24 22:41:39 +01:00 (Migrated from github.com)
Review

still need this?

still need this?
lyoshenka commented 2022-03-24 22:43:06 +01:00 (Migrated from github.com)
Review

typo

typo
lyoshenka commented 2022-03-24 22:43:32 +01:00 (Migrated from github.com)
Review

👀

:eyes:
jeffreypicard commented 2022-03-24 23:32:48 +01:00 (Migrated from github.com)
Review

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.
jeffreypicard commented 2022-03-24 23:39:47 +01:00 (Migrated from github.com)
Review
// 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.

``` // 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.
lyoshenka commented 2022-03-24 22:26:17 +01:00 (Migrated from github.com)
Review

no need to start these with N

no need to start these with N
lyoshenka commented 2022-03-24 22:26:38 +01:00 (Migrated from github.com)
Review

and many of these are unused

and many of these are unused
lyoshenka commented 2022-03-24 22:34:50 +01:00 (Migrated from github.com)
Review

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
lyoshenka commented 2022-03-24 22:38:01 +01:00 (Migrated from github.com)
Review

typo: Famlies -> Families

typo: Famlies -> Families
lyoshenka commented 2022-03-24 22:41:04 +01:00 (Migrated from github.com)
Review

this can be unexported

this can be unexported
lyoshenka commented 2022-03-24 22:41:39 +01:00 (Migrated from github.com)
Review

still need this?

still need this?
lyoshenka commented 2022-03-24 22:43:06 +01:00 (Migrated from github.com)
Review

typo

typo
lyoshenka commented 2022-03-24 22:43:32 +01:00 (Migrated from github.com)
Review

👀

:eyes:
jeffreypicard commented 2022-03-24 23:32:48 +01:00 (Migrated from github.com)
Review

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.
jeffreypicard commented 2022-03-24 23:39:47 +01:00 (Migrated from github.com)
Review
// 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.

``` // 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.
close(ch)
lyoshenka commented 2022-03-24 22:26:17 +01:00 (Migrated from github.com)
Review

no need to start these with N

no need to start these with N
lyoshenka commented 2022-03-24 22:26:38 +01:00 (Migrated from github.com)
Review

and many of these are unused

and many of these are unused
lyoshenka commented 2022-03-24 22:34:50 +01:00 (Migrated from github.com)
Review

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
lyoshenka commented 2022-03-24 22:38:01 +01:00 (Migrated from github.com)
Review

typo: Famlies -> Families

typo: Famlies -> Families
lyoshenka commented 2022-03-24 22:41:04 +01:00 (Migrated from github.com)
Review

this can be unexported

this can be unexported
lyoshenka commented 2022-03-24 22:41:39 +01:00 (Migrated from github.com)
Review

still need this?

still need this?
lyoshenka commented 2022-03-24 22:43:06 +01:00 (Migrated from github.com)
Review

typo

typo
lyoshenka commented 2022-03-24 22:43:32 +01:00 (Migrated from github.com)
Review

👀

:eyes:
jeffreypicard commented 2022-03-24 23:32:48 +01:00 (Migrated from github.com)
Review

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.
jeffreypicard commented 2022-03-24 23:39:47 +01:00 (Migrated from github.com)
Review
// 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.

``` // 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.
}()
lyoshenka commented 2022-03-24 22:26:17 +01:00 (Migrated from github.com)
Review

no need to start these with N

no need to start these with N
lyoshenka commented 2022-03-24 22:26:38 +01:00 (Migrated from github.com)
Review

and many of these are unused

and many of these are unused
lyoshenka commented 2022-03-24 22:34:50 +01:00 (Migrated from github.com)
Review

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
lyoshenka commented 2022-03-24 22:38:01 +01:00 (Migrated from github.com)
Review

typo: Famlies -> Families

typo: Famlies -> Families
lyoshenka commented 2022-03-24 22:41:04 +01:00 (Migrated from github.com)
Review

this can be unexported

this can be unexported
lyoshenka commented 2022-03-24 22:41:39 +01:00 (Migrated from github.com)
Review

still need this?

still need this?
lyoshenka commented 2022-03-24 22:43:06 +01:00 (Migrated from github.com)
Review

typo

typo
lyoshenka commented 2022-03-24 22:43:32 +01:00 (Migrated from github.com)
Review

👀

:eyes:
jeffreypicard commented 2022-03-24 23:32:48 +01:00 (Migrated from github.com)
Review

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.
jeffreypicard commented 2022-03-24 23:39:47 +01:00 (Migrated from github.com)
Review
// 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.

``` // 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 var prevKey []byte
// FIXME: There's messy uses of kv being nil / not nil here. // FIXME: There's messy uses of kv being nil / not nil here.

lyoshenka commented 2022-03-24 22:26:17 +01:00 (Migrated from github.com)
Review

no need to start these with N

no need to start these with N
lyoshenka commented 2022-03-24 22:26:38 +01:00 (Migrated from github.com)
Review

and many of these are unused

and many of these are unused
lyoshenka commented 2022-03-24 22:34:50 +01:00 (Migrated from github.com)
Review

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
lyoshenka commented 2022-03-24 22:38:01 +01:00 (Migrated from github.com)
Review

typo: Famlies -> Families

typo: Famlies -> Families
lyoshenka commented 2022-03-24 22:41:04 +01:00 (Migrated from github.com)
Review

this can be unexported

this can be unexported
lyoshenka commented 2022-03-24 22:41:39 +01:00 (Migrated from github.com)
Review

still need this?

still need this?
lyoshenka commented 2022-03-24 22:43:06 +01:00 (Migrated from github.com)
Review

typo

typo
lyoshenka commented 2022-03-24 22:43:32 +01:00 (Migrated from github.com)
Review

👀

:eyes:
jeffreypicard commented 2022-03-24 23:32:48 +01:00 (Migrated from github.com)
Review

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.
jeffreypicard commented 2022-03-24 23:39:47 +01:00 (Migrated from github.com)
Review
// 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.

``` // 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.
lyoshenka commented 2022-03-24 22:26:17 +01:00 (Migrated from github.com)
Review

no need to start these with N

no need to start these with N
lyoshenka commented 2022-03-24 22:26:38 +01:00 (Migrated from github.com)
Review

and many of these are unused

and many of these are unused
lyoshenka commented 2022-03-24 22:34:50 +01:00 (Migrated from github.com)
Review

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
lyoshenka commented 2022-03-24 22:38:01 +01:00 (Migrated from github.com)
Review

typo: Famlies -> Families

typo: Famlies -> Families
lyoshenka commented 2022-03-24 22:41:04 +01:00 (Migrated from github.com)
Review

this can be unexported

this can be unexported
lyoshenka commented 2022-03-24 22:41:39 +01:00 (Migrated from github.com)
Review

still need this?

still need this?
lyoshenka commented 2022-03-24 22:43:06 +01:00 (Migrated from github.com)
Review

typo

typo
lyoshenka commented 2022-03-24 22:43:32 +01:00 (Migrated from github.com)
Review

👀

:eyes:
jeffreypicard commented 2022-03-24 23:32:48 +01:00 (Migrated from github.com)
Review

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.
jeffreypicard commented 2022-03-24 23:39:47 +01:00 (Migrated from github.com)
Review
// 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.

``` // 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.

View file

@ -44,6 +44,7 @@ func (db *ReadOnlyDBColumnFamily) GetBlockHash(height uint32) ([]byte, error) {
key := prefixes.NewBlockHashKey(height) key := prefixes.NewBlockHashKey(height)
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return nil, err return nil, err
} else if slice.Size() == 0 { } else if slice.Size() == 0 {
@ -64,6 +65,7 @@ func (db *ReadOnlyDBColumnFamily) GetHeader(height uint32) ([]byte, error) {
key := prefixes.NewHeaderKey(height) key := prefixes.NewHeaderKey(height)
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return nil, err return nil, err
} else if slice.Size() == 0 { } else if slice.Size() == 0 {
@ -127,6 +129,7 @@ func (db *ReadOnlyDBColumnFamily) GetClaimsInChannelCount(channelHash []byte) (u
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return 0, err return 0, err
} else if slice.Size() == 0 { } else if slice.Size() == 0 {
@ -188,6 +191,7 @@ func (db *ReadOnlyDBColumnFamily) GetRepost(claimHash []byte) ([]byte, error) {
key := prefixes.NewRepostKey(claimHash) key := prefixes.NewRepostKey(claimHash)
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return nil, err return nil, err
} else if slice.Size() == 0 { } else if slice.Size() == 0 {
@ -234,6 +238,7 @@ func (db *ReadOnlyDBColumnFamily) GetChannelForClaim(claimHash []byte, txNum uin
key := prefixes.NewClaimToChannelKey(claimHash, txNum, position) key := prefixes.NewClaimToChannelKey(claimHash, txNum, position)
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return nil, err return nil, err
} else if slice.Size() == 0 { } else if slice.Size() == 0 {
@ -300,6 +305,7 @@ func (db *ReadOnlyDBColumnFamily) GetSupportAmount(claimHash []byte) (uint64, er
key := prefixes.NewSupportAmountKey(claimHash) key := prefixes.NewSupportAmountKey(claimHash)
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return 0, err return 0, err
} else if slice.Size() == 0 { } else if slice.Size() == 0 {
@ -322,6 +328,7 @@ func (db *ReadOnlyDBColumnFamily) GetTxHash(txNum uint32) ([]byte, error) {
key := prefixes.NewTxHashKey(txNum) key := prefixes.NewTxHashKey(txNum)
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -355,6 +362,7 @@ func (db *ReadOnlyDBColumnFamily) GetActivationFull(txNum uint32, postition uint
key := prefixes.NewActivationKey(typ, txNum, postition) key := prefixes.NewActivationKey(typ, txNum, postition)
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return 0, err return 0, err
} }
@ -379,6 +387,7 @@ func (db *ReadOnlyDBColumnFamily) GetCachedClaimTxo(claim []byte, useCache bool)
key := prefixes.NewClaimToTXOKey(claim) key := prefixes.NewClaimToTXOKey(claim)
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -418,6 +427,7 @@ func (db *ReadOnlyDBColumnFamily) GetControllingClaim(name string) (*prefixes.Cl
rawKey := key.PackKey() rawKey := key.PackKey()
log.Println(hex.EncodeToString(rawKey)) log.Println(hex.EncodeToString(rawKey))
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
log.Printf("slice: %#v", slice) log.Printf("slice: %#v", slice)
log.Printf("err: %#v", err) log.Printf("err: %#v", err)
@ -468,6 +478,7 @@ func (db *ReadOnlyDBColumnFamily) GetTxCount(height uint32) (*prefixes.TxCountVa
key := prefixes.NewTxCountKey(height) key := prefixes.NewTxCountKey(height)
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -490,6 +501,7 @@ func (db *ReadOnlyDBColumnFamily) GetDBState() (*prefixes.DBStateValue, error) {
key := prefixes.NewDBStateKey() key := prefixes.NewDBStateKey()
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return nil, err return nil, err
} else if slice.Size() == 0 { } else if slice.Size() == 0 {
@ -546,6 +558,7 @@ func (db *ReadOnlyDBColumnFamily) GetCachedClaimHash(txNum uint32, position uint
rawKey := key.PackKey() rawKey := key.PackKey()
slice, err := db.DB.GetCF(db.Opts, handle, rawKey) slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
defer slice.Free()
if err != nil { if err != nil {
return nil, err return nil, err
} else if slice.Size() == 0 { } else if slice.Size() == 0 {

View file

@ -108,9 +108,12 @@ func (opts *IterOptions) ReadRow(prevKey *[]byte) *prefixes.PrefixRowKV {
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
} }
key := it.Key() key := it.Key()
defer key.Free()
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
keyData := key.Data() keyData := key.Data()
keyLen := len(keyData) keyLen := len(keyData)
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
value := it.Value() value := it.Value()
defer value.Free()
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
valueData := value.Data() valueData := value.Data()
valueLen := len(valueData) valueLen := len(valueData)
@ -156,9 +159,6 @@ func (opts *IterOptions) ReadRow(prevKey *[]byte) *prefixes.PrefixRowKV {
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
} }
} }
key.Free()
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
value.Free()
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
kv := &prefixes.PrefixRowKV{ kv := &prefixes.PrefixRowKV{
Key: outKey, Key: outKey,
Value: outValue, Value: outValue,

lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go
lyoshenka commented 2022-04-15 16:06:27 +02:00 (Migrated from github.com)
Review

should this be named iterator.go or iteroptions.go? it only has options stuff in it

should this be named iterator.go or iteroptions.go? it only has options stuff in it
lyoshenka commented 2022-04-15 16:06:54 +02:00 (Migrated from github.com)
Review

or maybe just options.go

or maybe just options.go

View file

@ -5,6 +5,8 @@ import (
"fmt" "fmt"
"time" "time"
_ "net/http/pprof"
lyoshenka commented 2022-04-15 16:10:08 +02:00 (Migrated from github.com)
Review

prolly here just for profiling, right?

prolly here just for profiling, right?
jeffreypicard commented 2022-04-20 15:55:49 +02:00 (Migrated from github.com)
Review

yeah

yeah
pb "github.com/lbryio/hub/protobuf/go" pb "github.com/lbryio/hub/protobuf/go"
"github.com/lbryio/hub/server" "github.com/lbryio/hub/server"
"github.com/lbryio/lbry.go/v2/extras/util" "github.com/lbryio/lbry.go/v2/extras/util"

View file

@ -150,7 +150,7 @@ func (s *Server) Run() {
// initializes everything. It loads information about previously known peers, // initializes everything. It loads information about previously known peers,
// creates needed internal data structures, and initializes goroutines. // creates needed internal data structures, and initializes goroutines.
func MakeHubServer(ctx context.Context, args *Args) *Server { func MakeHubServer(ctx context.Context, args *Args) *Server {
grpcServer := grpc.NewServer(grpc.NumStreamWorkers(10)) grpcServer := grpc.NewServer(grpc.NumStreamWorkers(0))
multiSpaceRe, err := regexp.Compile(`\s{2,}`) multiSpaceRe, err := regexp.Compile(`\s{2,}`)
if err != nil { if err != nil {