Documentation
¶
Index ¶
- Constants
- func CborStore(bs blockstore.Blockstore) *cbor.BasicIpldStore
- func RobustHTTPClient() *http.Client
- func TestingHTTPClient() *http.Client
- func XRPCRetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error)
- type FakeKeyManager
- type LeveledSlog
- type LoggingBstore
- func (bs *LoggingBstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
- func (bs *LoggingBstore) DeleteBlock(ctx context.Context, c cid.Cid) error
- func (bs *LoggingBstore) Get(ctx context.Context, c cid.Cid) (blockformat.Block, error)
- func (bs *LoggingBstore) GetLoggedBlocks() []blockformat.Block
- func (bs *LoggingBstore) GetSize(ctx context.Context, c cid.Cid) (int, error)
- func (bs *LoggingBstore) Has(ctx context.Context, c cid.Cid) (bool, error)
- func (bs *LoggingBstore) HashOnRead(enabled bool)
- func (bs *LoggingBstore) Put(context.Context, blockformat.Block) error
- func (bs *LoggingBstore) PutMany(context.Context, []blockformat.Block) error
- type ParsedUri
- type ReadThroughBstore
- func (bs *ReadThroughBstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
- func (bs *ReadThroughBstore) DeleteBlock(ctx context.Context, c cid.Cid) error
- func (bs *ReadThroughBstore) Get(ctx context.Context, c cid.Cid) (blockformat.Block, error)
- func (bs *ReadThroughBstore) GetSize(ctx context.Context, c cid.Cid) (int, error)
- func (bs *ReadThroughBstore) Has(ctx context.Context, c cid.Cid) (bool, error)
- func (bs *ReadThroughBstore) HashOnRead(enabled bool)
- func (bs *ReadThroughBstore) Put(context.Context, blockformat.Block) error
- func (bs *ReadThroughBstore) PutMany(context.Context, []blockformat.Block) error
Constants ¶
const ISO8601 = "2006-01-02T15:04:05.000Z"
Variables ¶
This section is empty.
Functions ¶
func CborStore ¶
func CborStore(bs blockstore.Blockstore) *cbor.BasicIpldStore
func RobustHTTPClient ¶
Generates an HTTP client with decent general-purpose defaults around timeouts and retries. The returned client has the stdlib http.Client interface, but has Hashicorp retryablehttp logic internally.
This client will retry on connection errors, 5xx status (except 501). It will log intermediate failures with WARN level. This does not start from http.DefaultClient.
This should be usable for XRPC clients, and other general inter-service client needs. CLI tools might want shorter timeouts and fewer retries by default.
func TestingHTTPClient ¶
For use in local integration tests. Short timeouts, no retries, etc
func XRPCRetryPolicy ¶
XRPCRetryPolicy is a custom wrapper around retryablehttp.DefaultRetryPolicy. It treats `429 Too Many Requests` as non-retryable, so the application can decide how to deal with rate-limiting.
Types ¶
type FakeKeyManager ¶
type FakeKeyManager struct { }
func (*FakeKeyManager) SignForUser ¶
func (*FakeKeyManager) VerifyUserSignature ¶
type LeveledSlog ¶
type LeveledSlog struct {
// contains filtered or unexported fields
}
func (LeveledSlog) Debug ¶
func (l LeveledSlog) Debug(msg string, keysAndValues ...interface{})
func (LeveledSlog) Error ¶
func (l LeveledSlog) Error(msg string, keysAndValues ...interface{})
re-writes HTTP client ERROR to WARN level (because of retries)
func (LeveledSlog) Info ¶
func (l LeveledSlog) Info(msg string, keysAndValues ...interface{})
func (LeveledSlog) Warn ¶
func (l LeveledSlog) Warn(msg string, keysAndValues ...interface{})
type LoggingBstore ¶
type LoggingBstore struct {
// contains filtered or unexported fields
}
func NewLoggingBstore ¶
func NewLoggingBstore(base blockstore.Blockstore) *LoggingBstore
func (*LoggingBstore) AllKeysChan ¶
func (bs *LoggingBstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
func (*LoggingBstore) DeleteBlock ¶
func (bs *LoggingBstore) DeleteBlock(ctx context.Context, c cid.Cid) error
func (*LoggingBstore) Get ¶
func (bs *LoggingBstore) Get(ctx context.Context, c cid.Cid) (blockformat.Block, error)
func (*LoggingBstore) GetLoggedBlocks ¶
func (bs *LoggingBstore) GetLoggedBlocks() []blockformat.Block
func (*LoggingBstore) GetSize ¶
func (bs *LoggingBstore) GetSize(ctx context.Context, c cid.Cid) (int, error)
func (*LoggingBstore) Has ¶
func (bs *LoggingBstore) Has(ctx context.Context, c cid.Cid) (bool, error)
func (*LoggingBstore) HashOnRead ¶
func (bs *LoggingBstore) HashOnRead(enabled bool)
func (*LoggingBstore) Put ¶
func (bs *LoggingBstore) Put(context.Context, blockformat.Block) error
func (*LoggingBstore) PutMany ¶
func (bs *LoggingBstore) PutMany(context.Context, []blockformat.Block) error
type ParsedUri ¶
func ParseAtUri ¶
type ReadThroughBstore ¶
type ReadThroughBstore struct {
// contains filtered or unexported fields
}
func NewReadThroughBstore ¶
func NewReadThroughBstore(base, fresh blockstore.Blockstore) *ReadThroughBstore
func (*ReadThroughBstore) AllKeysChan ¶
func (bs *ReadThroughBstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
func (*ReadThroughBstore) DeleteBlock ¶
func (bs *ReadThroughBstore) DeleteBlock(ctx context.Context, c cid.Cid) error
func (*ReadThroughBstore) Get ¶
func (bs *ReadThroughBstore) Get(ctx context.Context, c cid.Cid) (blockformat.Block, error)
func (*ReadThroughBstore) GetSize ¶
func (bs *ReadThroughBstore) GetSize(ctx context.Context, c cid.Cid) (int, error)
func (*ReadThroughBstore) Has ¶
func (bs *ReadThroughBstore) Has(ctx context.Context, c cid.Cid) (bool, error)
func (*ReadThroughBstore) HashOnRead ¶
func (bs *ReadThroughBstore) HashOnRead(enabled bool)
func (*ReadThroughBstore) Put ¶
func (bs *ReadThroughBstore) Put(context.Context, blockformat.Block) error
func (*ReadThroughBstore) PutMany ¶
func (bs *ReadThroughBstore) PutMany(context.Context, []blockformat.Block) error