11import {
2- CommonKeyValueDBSaveBatchOptions ,
32 CommonDBCreateOptions ,
43 CommonKeyValueDB ,
4+ commonKeyValueDBFullSupport ,
5+ CommonKeyValueDBSaveBatchOptions ,
56 KeyValueDBTuple ,
67} from '@naturalcycles/db-lib'
78import { _chunk , StringMap } from '@naturalcycles/js-lib'
@@ -22,6 +23,10 @@ export class RedisHashKeyValueDB implements CommonKeyValueDB, AsyncDisposable {
2223 this . keyOfHashField = cfg . hashKey
2324 }
2425
26+ support = {
27+ ...commonKeyValueDBFullSupport ,
28+ }
29+
2530 async ping ( ) : Promise < void > {
2631 await this . client . ping ( )
2732 }
@@ -96,7 +101,7 @@ export class RedisHashKeyValueDB implements CommonKeyValueDB, AsyncDisposable {
96101 . take ( limit || Infinity )
97102 }
98103
99- streamEntries ( table : string , limit ?: number | undefined ) : ReadableTyped < KeyValueDBTuple > {
104+ streamEntries ( table : string , limit ?: number ) : ReadableTyped < KeyValueDBTuple > {
100105 return this . client
101106 . hscanStream ( this . keyOfHashField , {
102107 match : `${ table } :*` ,
@@ -116,10 +121,17 @@ export class RedisHashKeyValueDB implements CommonKeyValueDB, AsyncDisposable {
116121 } )
117122 }
118123
119- async increment ( table : string , id : string , by : number = 1 ) : Promise < number > {
124+ async increment ( table : string , id : string , by = 1 ) : Promise < number > {
120125 return await this . client . hincr ( this . keyOfHashField , this . idToKey ( table , id ) , by )
121126 }
122127
128+ async incrementBatch (
129+ _table : string ,
130+ _incrementMap : StringMap < number > ,
131+ ) : Promise < StringMap < number > > {
132+ throw new Error ( 'Not implemented' )
133+ }
134+
123135 async createTable ( table : string , opt ?: CommonDBCreateOptions ) : Promise < void > {
124136 if ( ! opt ?. dropIfExists ) return
125137
0 commit comments