@@ -54,59 +54,67 @@ class BlockService {
54
54
* Put a block to the underlying datastore.
55
55
*
56
56
* @param {Block } block
57
+ * @param {Object } [options] - Options is an object with the following properties
58
+ * @param {AbortSignal } [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation
57
59
* @returns {Promise }
58
60
*/
59
- put ( block ) {
61
+ put ( block , options ) {
60
62
if ( this . hasExchange ( ) ) {
61
- return this . _bitswap . put ( block )
63
+ return this . _bitswap . put ( block , options )
62
64
} else {
63
- return this . _repo . blocks . put ( block )
65
+ return this . _repo . blocks . put ( block , options )
64
66
}
65
67
}
66
68
67
69
/**
68
70
* Put a multiple blocks to the underlying datastore.
69
71
*
70
72
* @param {Array<Block> } blocks
73
+ * @param {Object } [options] - Options is an object with the following properties
74
+ * @param {AbortSignal } [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation
71
75
* @returns {Promise }
72
76
*/
73
- putMany ( blocks ) {
77
+ putMany ( blocks , options ) {
74
78
if ( this . hasExchange ( ) ) {
75
- return this . _bitswap . putMany ( blocks )
79
+ return this . _bitswap . putMany ( blocks , options )
76
80
} else {
77
- return this . _repo . blocks . putMany ( blocks )
81
+ return this . _repo . blocks . putMany ( blocks , options )
78
82
}
79
83
}
80
84
81
85
/**
82
86
* Get a block by cid.
83
87
*
84
88
* @param {CID } cid
89
+ * @param {Object } [options] - Options is an object with the following properties
90
+ * @param {AbortSignal } [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation
85
91
* @returns {Promise<Block> }
86
92
*/
87
- get ( cid ) {
93
+ get ( cid , options ) {
88
94
if ( this . hasExchange ( ) ) {
89
- return this . _bitswap . get ( cid )
95
+ return this . _bitswap . get ( cid , options )
90
96
} else {
91
- return this . _repo . blocks . get ( cid )
97
+ return this . _repo . blocks . get ( cid , options )
92
98
}
93
99
}
94
100
95
101
/**
96
102
* Get multiple blocks back from an array of cids.
97
103
*
98
104
* @param {Array<CID> } cids
105
+ * @param {Object } [options] - Options is an object with the following properties
106
+ * @param {AbortSignal } [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation
99
107
* @returns {Iterator<Block> }
100
108
*/
101
- getMany ( cids ) {
109
+ getMany ( cids , options ) {
102
110
if ( ! Array . isArray ( cids ) ) {
103
111
throw new Error ( 'first arg must be an array of cids' )
104
112
}
105
113
106
114
if ( this . hasExchange ( ) ) {
107
- return this . _bitswap . getMany ( cids )
115
+ return this . _bitswap . getMany ( cids , options )
108
116
} else {
109
- const getRepoBlocks = map ( ( cid ) => this . _repo . blocks . get ( cid ) )
117
+ const getRepoBlocks = map ( ( cid ) => this . _repo . blocks . get ( cid , options ) )
110
118
return getRepoBlocks ( cids )
111
119
}
112
120
}
@@ -115,10 +123,12 @@ class BlockService {
115
123
* Delete a block from the blockstore.
116
124
*
117
125
* @param {CID } cid
126
+ * @param {Object } [options] - Options is an object with the following properties
127
+ * @param {AbortSignal } [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation
118
128
* @returns {Promise }
119
129
*/
120
- delete ( cid ) {
121
- return this . _repo . blocks . delete ( cid )
130
+ delete ( cid , options ) {
131
+ return this . _repo . blocks . delete ( cid , options )
122
132
}
123
133
}
124
134
0 commit comments