bitswap: add few method comments

License: MIT
Signed-off-by: 's avatarJakub Sztandera <kubuxu@protonmail.ch>
上级 3be5c913
...@@ -78,6 +78,8 @@ func (bs *blockService) Exchange() exchange.Interface { ...@@ -78,6 +78,8 @@ func (bs *blockService) Exchange() exchange.Interface {
return bs.exchange 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 { func NewSession(ctx context.Context, bs BlockService) *Session {
exchange := bs.Exchange() exchange := bs.Exchange()
if bswap, ok := exchange.(*bitswap.Bitswap); ok { if bswap, ok := exchange.(*bitswap.Bitswap); ok {
......
...@@ -79,6 +79,7 @@ func (w *ThreadSafe) Add(c *cid.Cid, priority int, ses uint64) bool { ...@@ -79,6 +79,7 @@ func (w *ThreadSafe) Add(c *cid.Cid, priority int, ses uint64) bool {
return true return true
} }
// AddEntry adds given Entry to the wantlist. For more information see Add method.
func (w *ThreadSafe) AddEntry(e *Entry, ses uint64) bool { func (w *ThreadSafe) AddEntry(e *Entry, ses uint64) bool {
w.lk.Lock() w.lk.Lock()
defer w.lk.Unlock() defer w.lk.Unlock()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论