Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
Wrapped blockservice.BlockService
}
Adapter implements go-ipld-prime/storage.ReadableStorage and go-ipld-prime/storage.WritableStorage backed by a go-blockservice.BlockService.
The go-blockservice.BlockService may internally have other configuration, and contain whole other systems like Bitswap for transport. We don't interfere with that here; such configuration should be handled when creating the go-blockservice value.
Note that this system will only work for certain structures of keys -- this is because the blockservice API works on the level of CIDs. As long as your key string is the binary form of a CID, it will work correctly. Other keys are not possible to support with this adapter.
Contexts given to this system are passed through where possible, but it is not possible in all cases. For operations where the underlying interface doesn't accept a context parameter, this adapter will check the context for errors before beginning an operation, but the context will otherwise have no effect. For operations where BlockService does accept a context, we pass it on.
func (*Adapter) Has ¶
Has implements go-ipld-prime/storage.Storage.Has.
Note that for a BlockService, the Has operation has rather unusual semantics. Has may return false, and an immediately subsequent Get for the same key might return data! This is because the Has operation is defined as whether the Blockstore that the BlockService wraps has the requested key, immediately, locally; while the Get operation might use the BlockService to go _find_ the requested key and its content, even remotely!