Skip to content

Commit 0bf6478

Browse files
committed
Update readme and example
1 parent 0a014fc commit 0bf6478

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type Interface interface {
2424
To instantiate a backend, `_`-import all the backends that you want to register, and call:
2525

2626
```go
27-
func GetBackend(ctx context.Context, typeName string, options map[string]any) (Interface, error)
27+
func GetBackendWithParams(ctx context.Context, typeName string, params InitParams) (Interface, error)
2828
```
2929

3030
An example can be found in `example_test.go`.
@@ -38,8 +38,6 @@ type Storage struct {
3838
}
3939
```
4040

41-
For Go 1.17, replace `any` by `interface{}`.
42-
4341
## Limitations
4442

4543
The interface currently does not support streaming of large blobs. In the future we may provide this by implementing `fs.FS` in the backend for reading, and a similar interface for writing new blobs.
@@ -50,8 +48,6 @@ We support the last two stable Go versions, currently 1.17 and 1.18.
5048

5149
From a API consumer point of view, we do not plan any backward incompatible changes before a v1.0.
5250

53-
If you want to implement a storage backend, be aware that we will probably add a `Delete` method before v1.0.
54-
55-
Any future extensions most likely be added with optional interface, similar to the `fs.FS` design. Utility functions that return a compatible implementation will be used for backends that do not implement the interface, if possible.
51+
For storage backends, any future extensions most likely be added with optional interface, similar to the `fs.FS` design. Utility functions that return a compatible implementation will be used for backends that do not implement the interface, when possible.
5652

5753

example_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66

77
"github.com/PowerDNS/simpleblob"
8+
"github.com/go-logr/logr"
89

910
// Register the memory backend plugin
1011
_ "github.com/PowerDNS/simpleblob/backends/memory"
@@ -14,7 +15,10 @@ func Example() {
1415
// Do not forget the:
1516
// import _ "github.com/PowerDNS/simpleblob/backends/memory"
1617
ctx := context.Background()
17-
storage, err := simpleblob.GetBackend(ctx, "memory", map[string]interface{}{})
18+
storage, err := simpleblob.GetBackendWithParams(ctx, "memory", simpleblob.InitParams{
19+
OptionMap: map[string]interface{}{}, // add key-value options here
20+
Logger: logr.Discard(), // replace with a real logger
21+
})
1822
check(err)
1923
err = storage.Store(ctx, "example.txt", []byte("hello"))
2024
check(err)

0 commit comments

Comments
 (0)