Implement LazyArray.splice(), implement unshift/shift/push/pop in terms of splice...
[logjson.git] / LazyValue.mjs
1 import assert from 'assert'
2 import Transaction from './Transaction.mjs'
3 import logjson from './index.mjs'
4
5 class LazyValue {
6   constructor(transaction, ptr_len) {
7     assert(transaction instanceof Transaction)
8     this.transaction = transaction
9     this.ptr_len = ptr_len || null
10   }
11
12   has(key) {
13     throw new Error('not implemented')
14   }
15
16   async get(key, default_value) {
17     throw new Error('not implemented')
18   }
19
20   async get_json(key, default_value) {
21     return /*await*/ logjson.logjson_to_json(
22       await this.get(key, default_value)
23     )
24   }
25
26   set(key, value) {
27     throw new Error('not implemented')
28   }
29
30   set_json(key, value) {
31     this.set(key, this.transaction.json_to_logjson(value))
32   }
33
34   delete(key) {
35     throw new Error('not implemented')
36   }
37
38   async commit() {
39     throw new Error('not implemented')
40   }
41 }
42
43 export default LazyValue