File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,15 @@ end = struct
203203
204204 type t = shard_config
205205
206+ let parse_chain repr chain =
207+ List. fold_left
208+ (fun acc c ->
209+ acc >> = fun r ->
210+ ArrayToArray. parse r c >> = fun () ->
211+ ArrayToArray. compute_encoded_representation c r) (Ok repr) chain.a2a
212+ >> = fun repr' ->
213+ ArrayToBytes. parse repr' chain.a2b
214+
206215 let parse
207216 : type a b .
208217 (a , b ) Util. array_repr ->
@@ -217,15 +226,18 @@ end = struct
217226 the decoded representaton of a shard." in
218227 Result. error @@ `Sharding (t.chunk_shape, repr.shape, msg))
219228 >> = fun () ->
220- match
229+ ( match
221230 Array. for_all2 (fun x y -> (x mod y) = 0 ) repr.shape t.chunk_shape
222231 with
223232 | true -> Ok ()
224233 | false ->
225234 let msg =
226235 " sharding chunk_shape must evenly divide the size of the shard shape."
227236 in
228- Result. error @@ `Sharding (t.chunk_shape, repr.shape, msg)
237+ Result. error @@ `Sharding (t.chunk_shape, repr.shape, msg))
238+ >> = fun () ->
239+ parse_chain repr t.codecs >> = fun () ->
240+ parse_chain repr t.index_codecs
229241
230242 let compute_encoded_size input_size t =
231243 List. fold_left BytesToBytes. compute_encoded_size
You can’t perform that action at this time.
0 commit comments