Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storage): Rename type Writeable to Writable #114

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/serious-comics-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zarrita/storage": minor
---

fix(storage): Rename storage type `Writeable` to `Writable`
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ classDiagram

class core {
- open(store: Readable)
- create(store: Writeable)
- create(store: Writable)
- zarr.Array and zarr.Group
- access and decode individual chunks
}

class storage {
- Readable
- Writeable
- Writable
- Map()
- FetchStore()
- FileSystemStore()
Expand Down
4 changes: 2 additions & 2 deletions docs/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const arr = await zarr.open.v2(store, { kind: "array" });

## Create an Array <Badge type="tip" text="v3" />

Requires the `store` to implement `Writeable`.
Requires the `store` to implement `Writable`.

```js
import * as zarr from "zarrita";
Expand All @@ -75,7 +75,7 @@ arr; // zarr.Array<"int32", FileSystemStore>

## Create a Group <Badge type="tip" text="v3" />

Requires the `store` to implement `Writeable`.
Requires the `store` to implement `Writable`.

```js
import * as zarr from "zarrita";
Expand Down
10 changes: 5 additions & 5 deletions docs/packages/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ interface AsyncReadable<Options> {
}
```

and may optionally implement `Writeable` or `AsyncWriteable`:
and may optionally implement `Writable` or `AsyncWritable`:

```typescript
interface Writeable {
interface Writable {
set(key: string, value: Uint8Array): void;
}

interface AsyncWriteable {
interface AsyncWritable {
set(key: string, value: Uint8Array): Promise<void>;
}
```

That's it! `Readable`/`Writeable` are enough to allow an
That's it! `Readable`/`Writable` are enough to allow an
[ES6 Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
to serve as the most basic backend, while also facilitating developers in
creating their custom stores as needed.
Expand Down Expand Up @@ -69,7 +69,7 @@ const store = new FetchStore("http://localhost:8080/data.zarr", {
});
```

### FileSystemStore <Badge type="tip" text="Readable" /> <Badge type="tip" text="Writeable" />
### FileSystemStore <Badge type="tip" text="Readable" /> <Badge type="tip" text="Writable" />

Designed for JavaScript runtimes with file system access, the The
**FileSystemStore** is designed for JavaScript runtimes with file system access
Expand Down
2 changes: 1 addition & 1 deletion docs/what-is-zarrita.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Zarr.
### [@zarrita/storage](/packages/storage)

- A collection of useful of storage backends for Zarr.
- Implement your own `Readable` and (optionally `Writeable`) stores.
- Implement your own `Readable` and (optionally `Writable`) stores.

### [@zarrita/core](/packages/core)

Expand Down
10 changes: 5 additions & 5 deletions packages/storage/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ export interface SyncReadable<Options = unknown> {
): Uint8Array | undefined;
}

export type Writeable = AsyncWriteable | SyncWriteable;
export interface AsyncWriteable {
export type Writable = AsyncWritable | SyncWritable;
export interface AsyncWritable {
set(key: AbsolutePath, value: Uint8Array): Promise<void>;
}
export interface SyncWriteable {
export interface SyncWritable {
set(key: AbsolutePath, value: Uint8Array): void;
}

export type AsyncMutable<GetOptions = unknown> =
& AsyncReadable<GetOptions>
& AsyncWriteable;
& AsyncWritable;
export type SyncMutable<GetOptions = unknown> =
& SyncReadable<GetOptions>
& SyncWriteable;
& SyncWritable;
export type Mutable<GetOptions = unknown> =
| AsyncMutable<GetOptions>
| SyncMutable<GetOptions>;