add .Close() method to interface and all implementations.
This commit is contained in:
@@ -55,6 +55,8 @@ type ElasticsearchStorage struct {
|
|||||||
bi esutil.BulkIndexer
|
bi esutil.BulkIndexer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ess *ElasticsearchStorage) Close() {}
|
||||||
|
|
||||||
func (ess *ElasticsearchStorage) Init() error {
|
func (ess *ElasticsearchStorage) Init() error {
|
||||||
if ess.IndexName == "" {
|
if ess.IndexName == "" {
|
||||||
ess.IndexName = "events"
|
ess.IndexName = "events"
|
||||||
|
|||||||
@@ -13,3 +13,7 @@ type MySQLBackend struct {
|
|||||||
QueryKindsLimit int
|
QueryKindsLimit int
|
||||||
QueryTagsLimit int
|
QueryTagsLimit int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *MySQLBackend) Close() {
|
||||||
|
b.DB.Close()
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,3 +13,7 @@ type PostgresBackend struct {
|
|||||||
QueryKindsLimit int
|
QueryKindsLimit int
|
||||||
QueryTagsLimit int
|
QueryTagsLimit int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *PostgresBackend) Close() {
|
||||||
|
b.DB.Close()
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,3 +10,7 @@ type SQLite3Backend struct {
|
|||||||
MaxOpenConns int
|
MaxOpenConns int
|
||||||
MaxIdleConns int
|
MaxIdleConns int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *SQLite3Backend) Close() {
|
||||||
|
b.DB.Close()
|
||||||
|
}
|
||||||
|
|||||||
3
store.go
3
store.go
@@ -12,6 +12,9 @@ type Store interface {
|
|||||||
// allowing a storage to initialize its internal resources.
|
// allowing a storage to initialize its internal resources.
|
||||||
Init() error
|
Init() error
|
||||||
|
|
||||||
|
// Close must be called after you're done using the store, to free up resources and so on.
|
||||||
|
Close()
|
||||||
|
|
||||||
// QueryEvents is invoked upon a client's REQ as described in NIP-01.
|
// QueryEvents is invoked upon a client's REQ as described in NIP-01.
|
||||||
// it should return a channel with the events as they're recovered from a database.
|
// it should return a channel with the events as they're recovered from a database.
|
||||||
// the channel should be closed after the events are all delivered.
|
// the channel should be closed after the events are all delivered.
|
||||||
|
|||||||
Reference in New Issue
Block a user