Пример #1
0
func (me *mapPieceCompletion) Set(p metainfo.Piece, b bool) error {
	if b {
		if me.m == nil {
			me.m = make(map[metainfo.PieceKey]struct{})
		}
		me.m[p.Key()] = struct{}{}
	} else {
		delete(me.m, p.Key())
	}
	return nil
}
Пример #2
0
func (me *mapPieceCompletion) Get(p metainfo.Piece) (bool, error) {
	_, ok := me.m[p.Key()]
	return ok, nil
}