From ac0bbe775599d9b24353d619730ef6d2b3bb1dd4 Mon Sep 17 00:00:00 2001 From: Fabio Barone Date: Tue, 5 Feb 2019 19:59:55 -0500 Subject: [PATCH] swarm: fix linter issues and PR comments --- swarm/api/inspector.go | 10 +++++----- swarm/network/stream/common_test.go | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/swarm/api/inspector.go b/swarm/api/inspector.go index 4477d4435c..6706b32e65 100644 --- a/swarm/api/inspector.go +++ b/swarm/api/inspector.go @@ -1,4 +1,4 @@ -// Copyright 2016 The go-ethereum Authors +// Copyright 2019 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify @@ -33,18 +33,18 @@ func NewInspector(api *API, hive *network.Hive, netStore *storage.NetStore) *Ins return &Inspector{api, hive, netStore} } -// prints the kademlia table +// Hive prints the kademlia table func (inspector *Inspector) Hive() string { return inspector.hive.String() } type HasInfo struct { Addr string `json:"address"` - Has bool `json: "has"` + Has bool `json:"has"` } -// HasChunk returns an array of HasInfo structs, -// the bool indicating if the underlying datastore has +// Has checks whether each chunk address is present in the underlying datastore, +// the bool in the returned structs indicates if the underlying datastore has // the chunk stored with the given address (true), or not (false) func (inspector *Inspector) Has(chunkAddresses []storage.Address) []HasInfo { results := make([]HasInfo, 0) diff --git a/swarm/network/stream/common_test.go b/swarm/network/stream/common_test.go index 7b29626084..74b33a7473 100644 --- a/swarm/network/stream/common_test.go +++ b/swarm/network/stream/common_test.go @@ -137,6 +137,11 @@ func newRoundRobinStore(stores ...storage.ChunkStore) *roundRobinStore { } } +// not used in this context, only to fulfill ChunkStore interface +func (rrs *roundRobinStore) Has(ctx context.Context, addr storage.Address) bool { + panic("RoundRobinStor doesn't support HasChunk") +} + func (rrs *roundRobinStore) Get(ctx context.Context, addr storage.Address) (storage.Chunk, error) { return nil, errors.New("get not well defined on round robin store") }