@@ -13,7 +13,7 @@ import (
1313
1414type Client interface {
1515 Create (ctx context.Context , filter string ) error
16- Add (ctx context.Context , filter string , hashes []uint64 ) error
16+ Add (ctx context.Context , filter string , hashes []uint64 ) ( bool , error )
1717 Has (ctx context.Context , filter string , hashes []uint64 ) (bool , error )
1818 Drop (ctx context.Context , filter string ) error
1919 Shutdown ()
@@ -52,16 +52,20 @@ func (t *bloomClient) Create(ctx context.Context, filter string) error {
5252}
5353
5454// Add issues a command to add a specified key to a given filter
55- func (t * bloomClient ) Add (ctx context.Context , filter string , hashes []uint64 ) error {
55+ func (t * bloomClient ) Add (ctx context.Context , filter string , hashes []uint64 ) ( bool , error ) {
5656 req := & pb.KeyRequest {
5757 FilterName : filter ,
5858 Hashes : hashes ,
5959 }
6060
6161 timedCtx , cancel := context .WithTimeout (ctx , t .timeout )
6262 defer cancel ()
63- _ , err := t .client .Add (timedCtx , req )
64- return err
63+ resp , err := t .client .Add (timedCtx , req )
64+ var has bool
65+ if resp != nil {
66+ has = resp .Has
67+ }
68+ return has , err
6569}
6670
6771// Has checks if a given key exists in a specified filter
0 commit comments