Skip to content

Commit

Permalink
Merge branch 'main' into test/not-same-event-loop-concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Aug 9, 2024
2 parents c6df8dd + d9d283f commit 7691140
Show file tree
Hide file tree
Showing 84 changed files with 1,295 additions and 401 deletions.
392 changes: 392 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
# Packages

- [`/packages/blockstore-core`](./packages/blockstore-core) Contains various implementations of the API contract described in interface-blockstore
- [`/packages/blockstore-fs`](./packages/blockstore-fs) Blockstore implementation with file system backend
- [`/packages/blockstore-idb`](./packages/blockstore-idb) Blockstore implementation with IndexedDB backend
- [`/packages/blockstore-level`](./packages/blockstore-level) Blockstore implementation with level(up|down) backend
- [`/packages/blockstore-s3`](./packages/blockstore-s3) IPFS blockstore implementation backed by s3
- [`/packages/datastore-core`](./packages/datastore-core) Wrapper implementation for interface-datastore
- [`/packages/datastore-fs`](./packages/datastore-fs) Datastore implementation with file system backend
- [`/packages/datastore-idb`](./packages/datastore-idb) Datastore implementation with IndexedDB backend.
- [`/packages/datastore-level`](./packages/datastore-level) Datastore implementation with level(up|down) backend
- [`/packages/datastore-s3`](./packages/datastore-s3) IPFS datastore implementation backed by s3
- [`/packages/interface-blockstore`](./packages/interface-blockstore) An interface for storing and retrieving blocks
- [`/packages/interface-blockstore-tests`](./packages/interface-blockstore-tests) Compliance tests for the blockstore interface
- [`/packages/interface-datastore`](./packages/interface-datastore) datastore interface
- [`/packages/interface-datastore-tests`](./packages/interface-datastore-tests) Compliance tests for the datastore interface
- [`/packages/interface-store`](./packages/interface-store) A generic interface for storing and retrieving data
- [`packages/blockstore-core`](https://github.com/ipfs/js-stores/tree/main/packages/blockstore-core) Contains various implementations of the API contract described in interface-blockstore
- [`packages/blockstore-fs`](https://github.com/ipfs/js-stores/tree/main/packages/blockstore-fs) Blockstore implementation with file system backend
- [`packages/blockstore-idb`](https://github.com/ipfs/js-stores/tree/main/packages/blockstore-idb) Blockstore implementation with IndexedDB backend
- [`packages/blockstore-level`](https://github.com/ipfs/js-stores/tree/main/packages/blockstore-level) Blockstore implementation with level(up|down) backend
- [`packages/blockstore-s3`](https://github.com/ipfs/js-stores/tree/main/packages/blockstore-s3) IPFS blockstore implementation backed by s3
- [`packages/datastore-core`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-core) Wrapper implementation for interface-datastore
- [`packages/datastore-fs`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-fs) Datastore implementation with file system backend
- [`packages/datastore-idb`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-idb) Datastore implementation with IndexedDB backend.
- [`packages/datastore-level`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-level) Datastore implementation with level(up|down) backend
- [`packages/datastore-s3`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-s3) IPFS datastore implementation backed by s3
- [`packages/interface-blockstore`](https://github.com/ipfs/js-stores/tree/main/packages/interface-blockstore) An interface for storing and retrieving blocks
- [`packages/interface-blockstore-tests`](https://github.com/ipfs/js-stores/tree/main/packages/interface-blockstore-tests) Compliance tests for the blockstore interface
- [`packages/interface-datastore`](https://github.com/ipfs/js-stores/tree/main/packages/interface-datastore) datastore interface
- [`packages/interface-datastore-tests`](https://github.com/ipfs/js-stores/tree/main/packages/interface-datastore-tests) Compliance tests for the datastore interface
- [`packages/interface-store`](https://github.com/ipfs/js-stores/tree/main/packages/interface-store) A generic interface for storing and retrieving data

# API Docs

Expand All @@ -33,8 +33,8 @@

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
- Apache 2.0, ([LICENSE-APACHE](https://github.com/ipfs/js-stores/blob/main/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/ipfs/js-stores/blob/main/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

# Contribute

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@
"lint": "aegir run lint",
"dep-check": "aegir run dep-check",
"release": "run-s build docs:no-publish npm:release docs",
"npm:release": "aegir release",
"npm:release": "aegir run release",
"docs": "aegir docs",
"docs:no-publish": "aegir docs --publish false"
},
"devDependencies": {
"aegir": "^42.2.3",
"aegir": "^44.1.0",
"npm-run-all": "^4.1.5"
},
"workspaces": [
Expand Down
19 changes: 19 additions & 0 deletions packages/blockstore-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## blockstore-core [5.0.0](https://github.com/ipfs/js-stores/compare/blockstore-core-4.4.1...blockstore-core-5.0.0) (2024-08-02)


### ⚠ BREAKING CHANGES

* To detect the type of error thrown, use `.name` instead of `.code`

### Features

* use `.name` property for errors instead of `.code` ([#315](https://github.com/ipfs/js-stores/issues/315)) ([dacd6ce](https://github.com/ipfs/js-stores/commit/dacd6ce6f325262f1bc1451f20789e9e7cd9b9fd))



### Dependencies

* **interface-blockstore:** upgraded to 5.3.0
* **interface-store:** upgraded to 6.0.0
* **interface-blockstore-tests:** upgraded to 7.0.0

## blockstore-core [4.4.1](https://github.com/ipfs/js-stores/compare/blockstore-core-4.4.0...blockstore-core-4.4.1) (2024-04-09)


Expand Down
21 changes: 18 additions & 3 deletions packages/blockstore-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@
# About

<!--
!IMPORTANT!
Everything in this README between "# About" and "# Install" is automatically
generated and will be overwritten the next time the doc generator is run.
To make changes to this section, please update the @packageDocumentation section
of src/index.js or src/index.ts
To experiment with formatting, please run "npm run docs" from the root of this
repo and examine the changes made.
-->

Various Blockstore implementations are available.

## Implementations
Expand Down Expand Up @@ -97,7 +112,7 @@ $ npm i blockstore-core

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `BlockstoreCore` in the global namespace.
Loading this module through a script tag will make its exports available as `BlockstoreCore` in the global namespace.

```html
<script src="https://unpkg.com/blockstore-core/dist/index.min.js"></script>
Expand All @@ -111,8 +126,8 @@ Loading this module through a script tag will make it's exports available as `Bl

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
- Apache 2.0, ([LICENSE-APACHE](https://github.com/ipfs/js-stores/blob/main/packages/blockstore-core/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/ipfs/js-stores/blob/main/packages/blockstore-core/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

# Contribute

Expand Down
26 changes: 13 additions & 13 deletions packages/blockstore-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blockstore-core",
"version": "4.4.1",
"version": "5.0.0",
"description": "Contains various implementations of the API contract described in interface-blockstore",
"author": "Alex Potsides <alex.potsides@protocol.ai>",
"license": "Apache-2.0 OR MIT",
Expand Down Expand Up @@ -94,23 +94,23 @@
"test:firefox": "aegir test -t browser -- --browser firefox",
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
"test:electron-main": "aegir test -t electron-main",
"dep-check": "aegir dep-check"
"dep-check": "aegir dep-check",
"release": "aegir release"
},
"dependencies": {
"@libp2p/logger": "^4.0.6",
"err-code": "^3.0.1",
"@libp2p/logger": "^4.0.19",
"interface-blockstore": "^5.0.0",
"interface-store": "^5.0.0",
"it-drain": "^3.0.5",
"it-filter": "^3.0.4",
"it-merge": "^3.0.3",
"interface-store": "^6.0.0",
"it-drain": "^3.0.7",
"it-filter": "^3.1.1",
"it-merge": "^3.0.5",
"it-pushable": "^3.2.3",
"multiformats": "^13.0.1"
"multiformats": "^13.2.2"
},
"devDependencies": {
"aegir": "^42.2.3",
"interface-blockstore-tests": "^6.0.0",
"it-all": "^3.0.4",
"uint8arrays": "^5.0.2"
"aegir": "^44.1.0",
"interface-blockstore-tests": "^7.0.0",
"it-all": "^3.0.6",
"uint8arrays": "^5.1.0"
}
}
4 changes: 2 additions & 2 deletions packages/blockstore-core/src/black-hole.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NotFoundError } from 'interface-store'
import { BaseBlockstore } from './base.js'
import * as Errors from './errors.js'
import type { Pair } from 'interface-blockstore'
import type { Await, AwaitIterable } from 'interface-store'
import type { CID } from 'multiformats/cid'
Expand All @@ -10,7 +10,7 @@ export class BlackHoleBlockstore extends BaseBlockstore {
}

get (): Await<Uint8Array> {
throw Errors.notFoundError()
throw new NotFoundError()
}

has (): Await<boolean> {
Expand Down
41 changes: 0 additions & 41 deletions packages/blockstore-core/src/errors.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/blockstore-core/src/identity.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NotFoundError } from 'interface-store'
import { BaseBlockstore } from './base.js'
import { Errors } from './index.js'
import type { Blockstore, Pair } from 'interface-blockstore'
import type { AbortOptions, Await, AwaitIterable } from 'interface-store'
import type { CID } from 'multiformats/cid'
Expand Down Expand Up @@ -34,7 +34,7 @@ export class IdentityBlockstore extends BaseBlockstore {
}

if (this.child == null) {
throw Errors.notFoundError()
throw new NotFoundError()
}

return this.child.get(key)
Expand Down
6 changes: 0 additions & 6 deletions packages/blockstore-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,7 @@
* ```
*/

import * as ErrorsImport from './errors.js'

export { BaseBlockstore } from './base.js'
export { MemoryBlockstore } from './memory.js'
export { BlackHoleBlockstore } from './black-hole.js'
export { TieredBlockstore } from './tiered.js'

export const Errors = {
...ErrorsImport
}
4 changes: 2 additions & 2 deletions packages/blockstore-core/src/memory.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NotFoundError } from 'interface-store'
import { base32 } from 'multiformats/bases/base32'
import { CID } from 'multiformats/cid'
import * as raw from 'multiformats/codecs/raw'
import * as Digest from 'multiformats/hashes/digest'
import { BaseBlockstore } from './base.js'
import * as Errors from './errors.js'
import type { Pair } from 'interface-blockstore'
import type { Await, AwaitIterable } from 'interface-store'

Expand All @@ -26,7 +26,7 @@ export class MemoryBlockstore extends BaseBlockstore {
const buf = this.data.get(base32.encode(key.multihash.bytes))

if (buf == null) {
throw Errors.notFoundError()
throw new NotFoundError()
}

return buf
Expand Down
8 changes: 4 additions & 4 deletions packages/blockstore-core/src/tiered.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { logger } from '@libp2p/logger'
import { DeleteFailedError, NotFoundError, PutFailedError } from 'interface-store'
import drain from 'it-drain'
import filter from 'it-filter'
import merge from 'it-merge'
import { pushable } from 'it-pushable'
import { BaseBlockstore } from './base.js'
import * as Errors from './errors.js'
import type { Blockstore, Pair } from 'interface-blockstore'
import type { AbortOptions, AwaitIterable } from 'interface-store'
import type { CID } from 'multiformats/cid'
Expand All @@ -31,7 +31,7 @@ export class TieredBlockstore extends BaseBlockstore {
await Promise.all(this.stores.map(async store => { await store.put(key, value, options) }))
return key
} catch (err: any) {
throw Errors.putFailedError(err)
throw new PutFailedError(String(err))
}
}

Expand All @@ -44,7 +44,7 @@ export class TieredBlockstore extends BaseBlockstore {
log.error(err)
}
}
throw Errors.notFoundError()
throw new NotFoundError()
}

async has (key: CID, options?: AbortOptions): Promise<boolean> {
Expand All @@ -61,7 +61,7 @@ export class TieredBlockstore extends BaseBlockstore {
try {
await Promise.all(this.stores.map(async store => { await store.delete(key, options) }))
} catch (err: any) {
throw Errors.deleteFailedError(err)
throw new DeleteFailedError(String(err))
}
}

Expand Down
26 changes: 26 additions & 0 deletions packages/blockstore-fs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
## blockstore-fs [2.0.0](https://github.com/ipfs/js-stores/compare/blockstore-fs-1.1.11...blockstore-fs-2.0.0) (2024-08-02)


### ⚠ BREAKING CHANGES

* To detect the type of error thrown, use `.name` instead of `.code`

### Features

* use `.name` property for errors instead of `.code` ([#315](https://github.com/ipfs/js-stores/issues/315)) ([dacd6ce](https://github.com/ipfs/js-stores/commit/dacd6ce6f325262f1bc1451f20789e9e7cd9b9fd))



### Dependencies

* **interface-blockstore:** upgraded to 5.3.0
* **interface-store:** upgraded to 6.0.0
* **interface-blockstore-tests:** upgraded to 7.0.0

## blockstore-fs [1.1.11](https://github.com/ipfs/js-stores/compare/blockstore-fs-1.1.10...blockstore-fs-1.1.11) (2024-08-01)


### Dependencies

* bump it-glob from 2.0.7 to 3.0.1 ([#306](https://github.com/ipfs/js-stores/issues/306)) ([8f6313f](https://github.com/ipfs/js-stores/commit/8f6313f8a22cb537aeeac2a048aad644d3c9a7d2))

## blockstore-fs [1.1.10](https://github.com/ipfs/js-stores/compare/blockstore-fs-v1.1.9...blockstore-fs-1.1.10) (2024-02-12)


Expand Down
19 changes: 17 additions & 2 deletions packages/blockstore-fs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@
# About

<!--
!IMPORTANT!
Everything in this README between "# About" and "# Install" is automatically
generated and will be overwritten the next time the doc generator is run.
To make changes to this section, please update the @packageDocumentation section
of src/index.js or src/index.ts
To experiment with formatting, please run "npm run docs" from the root of this
repo and examine the changes made.
-->

A Blockstore implementation that stores blocks in the local filesystem.

## Example
Expand All @@ -33,8 +48,8 @@ $ npm i blockstore-fs

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
- Apache 2.0, ([LICENSE-APACHE](https://github.com/ipfs/js-stores/blob/main/packages/blockstore-fs/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/ipfs/js-stores/blob/main/packages/blockstore-fs/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

# Contribute

Expand Down
Loading

0 comments on commit 7691140

Please sign in to comment.