Al replace boltdb sqlite#313
Conversation
|
@blackgirlbytes BOOM! Happy Halloween! Got it done just in time! |
|
One quick note - I did notice the --- FAIL: TestGetPutDIDDHT (0.00s)
dns_test.go:70:
Error Trace: /home/ada/Projects/did-dht/impl/pkg/dht/dns_test.go:70
Error: Received unexpected error:
failed to initialize *jwk.ecdsaPublicKey from *ecdsa.PublicKey: invalid elliptic curve &{%!s(*elliptic.CurveParams=&{0xc0001553e0 0xc000155420 0xc0001554e0 0xc000155460 0xc0001554a0 256 secp256k1})}Is this expected, or am I missing a test config option/etc.? |
|
Hey @frankhinek , @decentralgabe , @angiejones ..we just got this amazing PR to replace bolt with SQLite. Since today is the last day of Hacktoberfest, any of you mind reviewing this and then merging it so Ada can get credit? Thank you! |
thereisnogabe
left a comment
There was a problem hiding this comment.
great start! please take a look at my comments
| } | ||
|
|
||
| func (s SQLite) migrate() error { | ||
| db, err := sql.Open("sqlite3", string(s)) |
There was a problem hiding this comment.
please make sqlite3 a const
| defer db.Close() | ||
|
|
||
| goose.SetBaseFS(migrations) | ||
| if err = goose.SetDialect("sqlite"); err != nil { |
| return err | ||
| } | ||
|
|
||
| if err = goose.Up(db, "migrations"); err != nil { |
|
|
||
| err = db.write(ctx, namespace, "tezos-testnet", dummyData) | ||
| assert.NoError(t, err) | ||
| func getTestDB(t *testing.T) storage.Storage { |
There was a problem hiding this comment.
please add some tests for the db
| type SQLite string | ||
|
|
||
| // NewSQLite creates a SQLite-based implementation of storage.Storage | ||
| func NewSQLite(uri string) (SQLite, error) { |
| } | ||
| switch u.Scheme { | ||
| case "bolt", "": | ||
| case "sqlite", "": |
There was a problem hiding this comment.
can this be removed and just made the default?
| "github.com/TBD54566975/did-dht/pkg/storage/db/sqlite" | ||
| ) | ||
|
|
||
| type Storage interface { |
There was a problem hiding this comment.
wondering if there should be a set of dynamic dispatch methods over the storage calls that can do a common set of validations (empty checks, for example)
What type of PR is this? (check all applicable)
Description
This PR removes BoltDB and replaces it with a sqlc-generated SQLite connection, as per #121, (see here. This includes removing BoltDB defaults and tests and replacing them with SQLite tests (largely based off of the PostgreSQL tests), as well as like connection logic an interface(s) (also likewise based off of the PostgreSQL code).
Related Tickets & Documents
Resolves #121
Mobile & Desktop Screenshots/Recordings
Added code snippets?
Added tests?
No tests? Add a note
Added to documentation?
No docs? Add a note
[optional] Are there any post-deployment tasks we need to perform?
N/A
[optional] What gif best describes this PR or how it makes you feel?
Anything happy and dancing!