@@ -1194,10 +1194,12 @@ def make_ws_schema(self):
11941194 "data_type" : dataclasses .asdict (self .structure ().data_type ),
11951195 }
11961196
1197- async def write (self , media_type , deserializer , entry , body ):
1197+ async def write (self , media_type , deserializer , entry , body , persist = True ):
11981198 shape = entry .structure ().shape
11991199 if self .context .streaming_cache :
12001200 await self ._stream (media_type , entry , body , shape )
1201+ if not persist :
1202+ return None
12011203 if entry .structure_family == "array" :
12021204 dtype = entry .structure ().data_type .to_numpy_dtype ()
12031205 data = await ensure_awaitable (deserializer , body , dtype , shape )
@@ -1207,14 +1209,16 @@ async def write(self, media_type, deserializer, entry, body):
12071209 raise NotImplementedError (entry .structure_family )
12081210 return await ensure_awaitable ((await self .get_adapter ()).write , data )
12091211
1210- async def write_block (self , block , media_type , deserializer , entry , body ):
1212+ async def write_block (self , block , media_type , deserializer , entry , body , persist = True ):
12111213 from tiled .adapters .array import slice_and_shape_from_block_and_chunks
12121214
12131215 _ , shape = slice_and_shape_from_block_and_chunks (
12141216 block , entry .structure ().chunks
12151217 )
12161218 if self .context .streaming_cache :
12171219 await self ._stream (media_type , entry , body , shape , block = block )
1220+ if not persist :
1221+ return None
12181222 if entry .structure_family == "array" :
12191223 dtype = entry .structure ().data_type .to_numpy_dtype ()
12201224 data = await ensure_awaitable (deserializer , body , dtype , shape )
@@ -1226,9 +1230,11 @@ async def write_block(self, block, media_type, deserializer, entry, body):
12261230 (await self .get_adapter ()).write_block , data , block
12271231 )
12281232
1229- async def patch (self , shape , offset , extend , media_type , deserializer , entry , body ):
1233+ async def patch (self , shape , offset , extend , media_type , deserializer , entry , body , persist = True ):
12301234 if self .context .streaming_cache :
12311235 await self ._stream (media_type , entry , body , shape , offset = offset )
1236+ if not persist :
1237+ return entry .structure ()
12321238 dtype = entry .structure ().data_type .to_numpy_dtype ()
12331239 data = await ensure_awaitable (deserializer , body , dtype , shape )
12341240 # assumes a single DataSource (currently only supporting zarr)
0 commit comments