mirror of
https://github.com/aljazceru/crawler_v2.git
synced 2025-12-17 07:24:21 +01:00
Firehose working
This commit is contained in:
@@ -101,6 +101,15 @@ func (r RedisDB) NodeByKey(ctx context.Context, pubkey string) (*graph.Node, err
|
||||
return parseNode(fields)
|
||||
}
|
||||
|
||||
// Exists checks for the existance of the pubkey
|
||||
func (r RedisDB) Exists(ctx context.Context, pubkey string) (bool, error) {
|
||||
exists, err := r.client.HExists(ctx, KeyKeyIndex, pubkey).Result()
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to check existance of pubkey %s: %w", pubkey, err)
|
||||
}
|
||||
return exists, nil
|
||||
}
|
||||
|
||||
func (r RedisDB) ensureExists(ctx context.Context, IDs ...graph.ID) error {
|
||||
if len(IDs) == 0 {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user