aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage/types.go
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2018-07-13 23:40:28 +0800
committerBalint Gabor <balint.g@gmail.com>2018-07-13 23:40:28 +0800
commit7c9314f231a7ddffbbbc5fec16c65519a0121eeb (patch)
treedbc4021b66ee8968ad747036741fac7e1b972a39 /swarm/storage/types.go
parentf7d3678c28c4b92e45a458e4785bd0f1cdc20e34 (diff)
downloadgo-tangerine-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar
go-tangerine-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar.gz
go-tangerine-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar.bz2
go-tangerine-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar.lz
go-tangerine-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar.xz
go-tangerine-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar.zst
go-tangerine-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.zip
swarm: integrate OpenTracing; propagate ctx to internal APIs (#17169)
* swarm: propagate ctx, enable opentracing * swarm/tracing: log error when tracing is misconfigured
Diffstat (limited to 'swarm/storage/types.go')
-rw-r--r--swarm/storage/types.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/swarm/storage/types.go b/swarm/storage/types.go
index 32880ead7..3114ef576 100644
--- a/swarm/storage/types.go
+++ b/swarm/storage/types.go
@@ -250,7 +250,8 @@ func GenerateRandomChunks(dataSize int64, count int) (chunks []*Chunk) {
// Size, Seek, Read, ReadAt
type LazySectionReader interface {
- Size(chan bool) (int64, error)
+ Context() context.Context
+ Size(context.Context, chan bool) (int64, error)
io.Seeker
io.Reader
io.ReaderAt
@@ -260,10 +261,14 @@ type LazyTestSectionReader struct {
*io.SectionReader
}
-func (r *LazyTestSectionReader) Size(chan bool) (int64, error) {
+func (r *LazyTestSectionReader) Size(context.Context, chan bool) (int64, error) {
return r.SectionReader.Size(), nil
}
+func (r *LazyTestSectionReader) Context() context.Context {
+ return context.TODO()
+}
+
type StoreParams struct {
Hash SwarmHasher `toml:"-"`
DbCapacity uint64
@@ -298,7 +303,7 @@ type Reference []byte
// Putter is responsible to store data and create a reference for it
type Putter interface {
- Put(ChunkData) (Reference, error)
+ Put(context.Context, ChunkData) (Reference, error)
// RefSize returns the length of the Reference created by this Putter
RefSize() int64
// Close is to indicate that no more chunk data will be Put on this Putter
@@ -309,7 +314,7 @@ type Putter interface {
// Getter is an interface to retrieve a chunk's data by its reference
type Getter interface {
- Get(Reference) (ChunkData, error)
+ Get(context.Context, Reference) (ChunkData, error)
}
// NOTE: this returns invalid data if chunk is encrypted