Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zoj613 committed Dec 25, 2024
1 parent cdd6f55 commit 2a6ced3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ arrays, designed for use in parallel computing.
- Supports creating n-dimensional Zarr arrays and chunking them along any dimension.
- Compresses chunks using a variety of supported compression codecs.
- Supports indexing operations to read/write views of a Zarr array.
- Supports storing arrays in-memory or the local filesystem. It is also
extensible, allowing users to easily create and use their own custom storage
backends. See the example implementing a [Zip file store][9] for more details.
- Supports many storage backends, including in-memory store, the local filesystem,
Amazon S3 and others. It is also extensible, allowing users to easily create and
use their own custom storage backends. See the example implementing a
[Zip archive store][9] for more details.
- Supports both synchronous and asynchronous I/O via [Lwt][4] and [Eio][8]. The user can
easily use their own scheduler of choice. See the [example][10] implementing
a filesystem store that uses the [Picos][11] concurrency library for non-blocking I/O.
Expand Down
13 changes: 4 additions & 9 deletions zarr-sync/test/test_sync.ml
Original file line number Diff line number Diff line change
Expand Up @@ -251,23 +251,18 @@ module Dir_http_server = struct
S.Response.make_raw ~headers ~code:200 s
);
(* POST request handler *)
S.add_route_handler_stream server ~meth:`POST S.Route.rest_of_path_urlencoded (fun path req ->
let write oc =
let max_size = 1024 * 10 * 1024 in
let req' = S.Request.limit_body_size ~bytes:(Bytes.create 4096) ~max_size req in
S.IO.Input.iter (Out_channel.output oc) req'.body;
Out_channel.flush oc
in
S.add_route_handler server ~meth:`POST S.Route.rest_of_path_urlencoded (fun path req ->
let write oc = Out_channel.(output_string oc req.S.Request.body; flush oc) in
let fspath = Filename.concat dir path in
Zarr.Util.create_parent_dir fspath 0o700;
let f = [Open_wronly; Open_trunc; Open_creat] in
match Out_channel.(with_open_gen f 0o700 fspath write) with
| exception Sys_error e -> S.Response.make_raw ~code:500 e
| exception Sys_error e -> S.Response.fail ~code:500 "Upload error: %s" e
| () ->
let opt = List.assoc_opt "content-type" req.headers in
let content_type = Option.fold ~none:"application/octet-stream" ~some:Fun.id opt in
let headers = [("content-type", content_type); ("Connection", "close")] in
S.Response.make_raw ~headers ~code:201 (Printf.sprintf "%s created" path)
S.Response.make_string ~headers (Ok (Printf.sprintf "%s created" path))
);
(* DELETE request handler *)
S.add_route_handler server ~meth:`DELETE S.Route.rest_of_path_urlencoded (fun path _ ->
Expand Down

0 comments on commit 2a6ced3

Please sign in to comment.