diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2018-07-13 23:40:28 +0800 |
---|---|---|
committer | Balint Gabor <balint.g@gmail.com> | 2018-07-13 23:40:28 +0800 |
commit | 7c9314f231a7ddffbbbc5fec16c65519a0121eeb (patch) | |
tree | dbc4021b66ee8968ad747036741fac7e1b972a39 /swarm/storage/chunkstore.go | |
parent | f7d3678c28c4b92e45a458e4785bd0f1cdc20e34 (diff) | |
download | dexon-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar dexon-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar.gz dexon-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar.bz2 dexon-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar.lz dexon-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar.xz dexon-7c9314f231a7ddffbbbc5fec16c65519a0121eeb.tar.zst dexon-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/chunkstore.go')
-rw-r--r-- | swarm/storage/chunkstore.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/swarm/storage/chunkstore.go b/swarm/storage/chunkstore.go index ce95cd971..3b4d97a7a 100644 --- a/swarm/storage/chunkstore.go +++ b/swarm/storage/chunkstore.go @@ -16,7 +16,10 @@ package storage -import "sync" +import ( + "context" + "sync" +) /* ChunkStore interface is implemented by : @@ -28,8 +31,8 @@ ChunkStore interface is implemented by : - FakeChunkStore: dummy store which doesn't store anything just implements the interface */ type ChunkStore interface { - Put(*Chunk) // effectively there is no error even if there is an error - Get(Address) (*Chunk, error) + Put(context.Context, *Chunk) // effectively there is no error even if there is an error + Get(context.Context, Address) (*Chunk, error) Close() } @@ -45,14 +48,14 @@ func NewMapChunkStore() *MapChunkStore { } } -func (m *MapChunkStore) Put(chunk *Chunk) { +func (m *MapChunkStore) Put(ctx context.Context, chunk *Chunk) { m.mu.Lock() defer m.mu.Unlock() m.chunks[chunk.Addr.Hex()] = chunk chunk.markAsStored() } -func (m *MapChunkStore) Get(addr Address) (*Chunk, error) { +func (m *MapChunkStore) Get(ctx context.Context, addr Address) (*Chunk, error) { m.mu.RLock() defer m.mu.RUnlock() chunk := m.chunks[addr.Hex()] |