upgrade status-protocol-go (#1619)

This commit is contained in:
Andrea Maria Piana 2019-09-26 11:26:33 +02:00 committed by GitHub
parent 9a3ed980c9
commit 40e66e6186
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 14 deletions

2
go.mod
View File

@ -21,7 +21,7 @@ require (
github.com/status-im/doubleratchet v2.0.0+incompatible github.com/status-im/doubleratchet v2.0.0+incompatible
github.com/status-im/migrate/v4 v4.0.0-20190821140204-a9d340ec8fb76af4afda06acf01740d45d2661ed github.com/status-im/migrate/v4 v4.0.0-20190821140204-a9d340ec8fb76af4afda06acf01740d45d2661ed
github.com/status-im/rendezvous v1.3.0 github.com/status-im/rendezvous v1.3.0
github.com/status-im/status-protocol-go v0.0.0-20190926044311-1e2e007bc607 github.com/status-im/status-protocol-go v0.0.0-20190926081215-cc44ddb7ce44
github.com/status-im/whisper v1.4.14 github.com/status-im/whisper v1.4.14
github.com/stretchr/testify v1.3.1-0.20190712000136-221dbe5ed467 github.com/stretchr/testify v1.3.1-0.20190712000136-221dbe5ed467
github.com/syndtr/goleveldb v1.0.0 github.com/syndtr/goleveldb v1.0.0

4
go.sum
View File

@ -456,8 +456,8 @@ github.com/status-im/migrate/v4 v4.0.0-20190821140204-a9d340ec8fb76af4afda06acf0
github.com/status-im/migrate/v4 v4.0.0-20190821140204-a9d340ec8fb76af4afda06acf01740d45d2661ed/go.mod h1:r8HggRBZ/k7TRwByq/Hp3P/ubFppIna0nvyavVK0pjA= github.com/status-im/migrate/v4 v4.0.0-20190821140204-a9d340ec8fb76af4afda06acf01740d45d2661ed/go.mod h1:r8HggRBZ/k7TRwByq/Hp3P/ubFppIna0nvyavVK0pjA=
github.com/status-im/rendezvous v1.3.0 h1:7RK/MXXW+tlm0asKm1u7Qp7Yni6AO29a7j8+E4Lbjg4= github.com/status-im/rendezvous v1.3.0 h1:7RK/MXXW+tlm0asKm1u7Qp7Yni6AO29a7j8+E4Lbjg4=
github.com/status-im/rendezvous v1.3.0/go.mod h1:+hzjuP+j/XzLPeF6E50b88pWOTLdTcwjvNYt+Gh1W1s= github.com/status-im/rendezvous v1.3.0/go.mod h1:+hzjuP+j/XzLPeF6E50b88pWOTLdTcwjvNYt+Gh1W1s=
github.com/status-im/status-protocol-go v0.0.0-20190926044311-1e2e007bc607 h1:TKNkXEZfWKlOISfEWAxooQe1nmRHELXLhvp/ep1b6lI= github.com/status-im/status-protocol-go v0.0.0-20190926081215-cc44ddb7ce44 h1:RzyVhzGT79zfFFW7RpGnfk/Nvg+WjgTamGdw4o2InYk=
github.com/status-im/status-protocol-go v0.0.0-20190926044311-1e2e007bc607/go.mod h1:g059a1CeUmHKzsokiKwdk5pCuhCPE1GeOh8vULbfn5w= github.com/status-im/status-protocol-go v0.0.0-20190926081215-cc44ddb7ce44/go.mod h1:g059a1CeUmHKzsokiKwdk5pCuhCPE1GeOh8vULbfn5w=
github.com/status-im/whisper v1.4.14 h1:9VHqx4+PUYfhDnYYtDxHkg/3cfVvkHjPNciY4LO83yc= github.com/status-im/whisper v1.4.14 h1:9VHqx4+PUYfhDnYYtDxHkg/3cfVvkHjPNciY4LO83yc=
github.com/status-im/whisper v1.4.14/go.mod h1:WS6z39YJQ8WJa9s+DmTuEM/s2nVF6Iz3B1SZYw5cYf0= github.com/status-im/whisper v1.4.14/go.mod h1:WS6z39YJQ8WJa9s+DmTuEM/s2nVF6Iz3B1SZYw5cYf0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

View File

@ -235,25 +235,22 @@ func NewMessenger(
} }
} }
var err error
// Configure the database. // Configure the database.
database := c.db database := c.db
if database == nil && c.dbConfig != (dbConfig{}) { if c.db == nil && c.dbConfig == (dbConfig{}) {
return nil, errors.New("database instance or database path needs to be provided")
}
if c.db == nil {
logger.Info("opening a database", zap.String("dbPath", c.dbConfig.dbPath)) logger.Info("opening a database", zap.String("dbPath", c.dbConfig.dbPath))
var err error
database, err = sqlite.Open(c.dbConfig.dbPath, c.dbConfig.dbKey) database, err = sqlite.Open(c.dbConfig.dbPath, c.dbConfig.dbKey)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "failed to initialize database from the db config") return nil, errors.Wrap(err, "failed to initialize database from the db config")
} }
} else {
logger.Info("using in-memory database")
database, err = sqlite.Open(":memory:", "")
if err != nil {
return nil, errors.Wrap(err, "failed to initialize in-memory database")
}
} }
// Apply migrations for all components. // Apply migrations for all components.
err = sqlite.Migrate(database) err := sqlite.Migrate(database)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "failed to apply migrations") return nil, errors.Wrap(err, "failed to apply migrations")
} }

2
vendor/modules.txt vendored
View File

@ -319,7 +319,7 @@ github.com/status-im/migrate/v4/source/go_bindata
github.com/status-im/rendezvous github.com/status-im/rendezvous
github.com/status-im/rendezvous/protocol github.com/status-im/rendezvous/protocol
github.com/status-im/rendezvous/server github.com/status-im/rendezvous/server
# github.com/status-im/status-protocol-go v0.0.0-20190926044311-1e2e007bc607 # github.com/status-im/status-protocol-go v0.0.0-20190926081215-cc44ddb7ce44
github.com/status-im/status-protocol-go github.com/status-im/status-protocol-go
github.com/status-im/status-protocol-go/applicationmetadata github.com/status-im/status-protocol-go/applicationmetadata
github.com/status-im/status-protocol-go/crypto github.com/status-im/status-protocol-go/crypto