Firehose working

This commit is contained in:
pippellia-btc
2025-05-29 17:05:57 +02:00
parent de56ecd913
commit 768cec8fea
4 changed files with 196 additions and 0 deletions

View File

@@ -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