bitswap: add few method comments

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
Jakub Sztandera 2017-07-07 20:54:07 +02:00
parent 3be5c913ee
commit dd7589bdaf
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA
2 changed files with 3 additions and 0 deletions

View File

@ -78,6 +78,8 @@ func (bs *blockService) Exchange() exchange.Interface {
return bs.exchange
}
// NewSession creates a bitswap session that allows for controlled exchange of
// wantlists to decrease the bandwidth overhead.
func NewSession(ctx context.Context, bs BlockService) *Session {
exchange := bs.Exchange()
if bswap, ok := exchange.(*bitswap.Bitswap); ok {

View File

@ -79,6 +79,7 @@ func (w *ThreadSafe) Add(c *cid.Cid, priority int, ses uint64) bool {
return true
}
// AddEntry adds given Entry to the wantlist. For more information see Add method.
func (w *ThreadSafe) AddEntry(e *Entry, ses uint64) bool {
w.lk.Lock()
defer w.lk.Unlock()