Skip to content

Commit 0aa0944

Browse files
deps(dev): bump aegir from 40.0.13 to 41.1.9 (#268)
Bumps [aegir](https://github.com/ipfs/aegir) from 40.0.13 to 41.1.9. - [Release notes](https://github.com/ipfs/aegir/releases) - [Changelog](https://github.com/ipfs/aegir/blob/master/CHANGELOG.md) - [Commits](ipfs/aegir@v40.0.13...v41.1.9) --- updated-dependencies: - dependency-name: aegir dependency-type: direct:development update-type: version-update:semver-major ... --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: achingbrain <[email protected]>
1 parent c08d29a commit 0aa0944

File tree

54 files changed

+760
-628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+760
-628
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Semantic PR
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
uses: pl-strflt/.github/.github/workflows/[email protected]

README.md

+4-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
# stores <!-- omit in toc -->
2-
31
[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
42
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
53
[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores)
64
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-stores/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/js-stores/actions/workflows/js-test-and-release.yml?query=branch%3Amain)
75

86
> Blockstores and datastores used by IP-JS internals
97
10-
## Table of contents <!-- omit in toc -->
11-
12-
- [Structure](#structure)
13-
- [Packages](#packages)
14-
- [API Docs](#api-docs)
15-
- [License](#license)
16-
- [Contribute](#contribute)
17-
18-
## Structure
8+
# Packages
199

2010
- [`/packages/blockstore-core`](./packages/blockstore-core) Contains various implementations of the API contract described in interface-blockstore
2111
- [`/packages/blockstore-fs`](./packages/blockstore-fs) Blockstore implementation with file system backend
@@ -33,22 +23,18 @@
3323
- [`/packages/interface-datastore-tests`](./packages/interface-datastore-tests) Compliance tests for the datastore interface
3424
- [`/packages/interface-store`](./packages/interface-store) A generic interface for storing and retrieving data
3525

36-
## Packages
37-
38-
See the [./packages](./packages) directory for the various interfaces.
39-
40-
## API Docs
26+
# API Docs
4127

4228
- <https://ipfs.github.io/js-stores>
4329

44-
## License
30+
# License
4531

4632
Licensed under either of
4733

4834
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
4935
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
5036

51-
## Contribute
37+
# Contribute
5238

5339
Contributions welcome! Please check out [the issues](https://github.com/ipfs/js-stores/issues).
5440

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"release": "npm run docs:no-publish && aegir run release && npm run docs"
3232
},
3333
"devDependencies": {
34-
"aegir": "^40.0.8"
34+
"aegir": "^41.1.9"
3535
},
3636
"workspaces": [
3737
"packages/*"

packages/blockstore-core/README.md

+5-86
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,36 @@
1-
# blockstore-core <!-- omit in toc -->
2-
31
[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
42
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
53
[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores)
64
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-stores/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/js-stores/actions/workflows/js-test-and-release.yml?query=branch%3Amain)
75

86
> Contains various implementations of the API contract described in interface-blockstore
97
10-
## Table of contents <!-- omit in toc -->
11-
12-
- [Install](#install)
13-
- [Browser `<script>` tag](#browser-script-tag)
14-
- [Implementations](#implementations)
15-
- [Usage](#usage)
16-
- [BaseBlockstore](#baseblockstore)
17-
- [MemoryBlockstore](#memoryblockstore)
18-
- [BlackHoleBlockstore](#blackholeblockstore)
19-
- [TieredBlockstore](#tieredblockstore)
20-
- [API Docs](#api-docs)
21-
- [License](#license)
22-
- [Contribute](#contribute)
23-
24-
## Install
8+
# Install
259

2610
```console
2711
$ npm i blockstore-core
2812
```
2913

30-
### Browser `<script>` tag
14+
## Browser `<script>` tag
3115

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

3418
```html
3519
<script src="https://unpkg.com/blockstore-core/dist/index.min.js"></script>
3620
```
3721

38-
## Implementations
39-
40-
- Base: [`src/base`](src/base.ts)
41-
- Memory: [`src/memory`](src/memory.ts)
42-
- BlackHole: ['src/black-hole](src/black-hole.ts)
43-
- Tiered: ['src/tiered](src/tiered.ts)
44-
45-
## Usage
46-
47-
### BaseBlockstore
48-
49-
Provides a complete implementation of the Blockstore interface. You must implement `.get`, `.put`, etc.
50-
51-
```js
52-
import { BaseBlockstore } from 'blockstore-core/base'
53-
54-
class MyCustomBlockstore extends BaseBlockstore {
55-
put (key, val, options) {
56-
// store a block
57-
}
58-
59-
get (key, options) {
60-
// retrieve a block
61-
}
62-
63-
// ...etc
64-
}
65-
```
66-
67-
### MemoryBlockstore
68-
69-
A simple Blockstore that stores blocks in memory.
70-
71-
```js
72-
import { MemoryBlockstore } from 'blockstore-core/memory'
73-
74-
const store = new MemoryBlockstore()
75-
```
76-
77-
### BlackHoleBlockstore
78-
79-
A Blockstore that does not store any blocks.
80-
81-
```js
82-
import { BlackHoleBlockstore } from 'blockstore-core/black-hole'
83-
84-
const store = new BlackHoleBlockstore()
85-
```
86-
87-
### TieredBlockstore
88-
89-
A tiered blockstore wraps one or more blockstores and will query each in parallel to retrieve a block - the operation will succeed if any wrapped store has the block.
90-
91-
Writes are invoked on all wrapped blockstores.
92-
93-
```js
94-
import { TieredBlockstore } from 'blockstore-core/tiered'
95-
96-
const store = new TieredBlockstore([
97-
store1,
98-
store2,
99-
// ...etc
100-
])
101-
```
102-
103-
## API Docs
22+
# API Docs
10423

10524
- <https://ipfs.github.io/js-stores/modules/blockstore_core.html>
10625

107-
## License
26+
# License
10827

10928
Licensed under either of
11029

11130
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
11231
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
11332

114-
## Contribute
33+
# Contribute
11534

11635
Contributions welcome! Please check out [the issues](https://github.com/ipfs/js-stores/issues).
11736

packages/blockstore-core/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"eslintConfig": {
7272
"extends": "ipfs",
7373
"parserOptions": {
74+
"project": true,
7475
"sourceType": "module"
7576
}
7677
},
@@ -186,7 +187,7 @@
186187
"uint8arrays": "^4.0.2"
187188
},
188189
"devDependencies": {
189-
"aegir": "^40.0.8",
190+
"aegir": "^41.1.9",
190191
"interface-blockstore-tests": "^6.0.0"
191192
}
192193
}

packages/blockstore-core/src/index.ts

+69
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,72 @@
1+
/**
2+
* @packageDocumentation
3+
*
4+
* Various Blockstore implementations are available.
5+
*
6+
* ## Implementations
7+
*
8+
* - Base: [`src/base`](src/base.ts)
9+
* - Memory: [`src/memory`](src/memory.ts)
10+
* - BlackHole: ['src/black-hole](src/black-hole.ts)
11+
* - Tiered: ['src/tiered](src/tiered.ts)
12+
*
13+
* @example BaseBlockstore
14+
*
15+
* Provides a complete implementation of the Blockstore interface. You must implement `.get`, `.put`, etc.
16+
*
17+
* ```js
18+
* import { BaseBlockstore } from 'blockstore-core/base'
19+
*
20+
* class MyCustomBlockstore extends BaseBlockstore {
21+
* put (key, val, options) {
22+
* // store a block
23+
* }
24+
*
25+
* get (key, options) {
26+
* // retrieve a block
27+
* }
28+
*
29+
* // ...etc
30+
* }
31+
* ```
32+
*
33+
* @example MemoryBlockstore
34+
*
35+
* A simple Blockstore that stores blocks in memory.
36+
*
37+
* ```js
38+
* import { MemoryBlockstore } from 'blockstore-core/memory'
39+
*
40+
* const store = new MemoryBlockstore()
41+
* ```
42+
*
43+
* @example BlackHoleBlockstore
44+
*
45+
* A Blockstore that does not store any blocks.
46+
*
47+
* ```js
48+
* import { BlackHoleBlockstore } from 'blockstore-core/black-hole'
49+
*
50+
* const store = new BlackHoleBlockstore()
51+
* ```
52+
*
53+
* @example TieredBlockstore
54+
*
55+
* A tiered blockstore wraps one or more blockstores and will query each in parallel to retrieve a block - the operation will succeed if any wrapped store has the block.
56+
*
57+
* Writes are invoked on all wrapped blockstores.
58+
*
59+
* ```js
60+
* import { TieredBlockstore } from 'blockstore-core/tiered'
61+
*
62+
* const store = new TieredBlockstore([
63+
* store1,
64+
* store2,
65+
* // ...etc
66+
* ])
67+
* ```
68+
*/
69+
170
import * as ErrorsImport from './errors.js'
271

372
export { BaseBlockstore } from './base.js'

packages/blockstore-core/test/memory.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { interfaceBlockstoreTests } from 'interface-blockstore-tests'
44
import { MemoryBlockstore } from '../src/memory.js'
55

66
describe('memory', () => {
7-
describe('interface-datastore', () => {
7+
describe('interface-blockstore', () => {
88
interfaceBlockstoreTests({
99
setup () {
1010
return new MemoryBlockstore()

packages/blockstore-fs/README.md

+4-22
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,28 @@
1-
# blockstore-fs <!-- omit in toc -->
2-
31
[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
42
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
53
[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores)
64
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-stores/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/js-stores/actions/workflows/js-test-and-release.yml?query=branch%3Amain)
75

86
> Blockstore implementation with file system backend
97
10-
## Table of contents <!-- omit in toc -->
11-
12-
- [Install](#install)
13-
- [Usage](#usage)
14-
- [API Docs](#api-docs)
15-
- [License](#license)
16-
- [Contribute](#contribute)
17-
18-
## Install
8+
# Install
199

2010
```console
2111
$ npm i blockstore-fs
2212
```
2313

24-
## Usage
25-
26-
```js
27-
import { FsBlockstore } from 'blockstore-fs'
28-
29-
const store = new FsBlockstore('path/to/store')
30-
```
31-
32-
## API Docs
14+
# API Docs
3315

3416
- <https://ipfs.github.io/js-stores/modules/blockstore_fs.html>
3517

36-
## License
18+
# License
3719

3820
Licensed under either of
3921

4022
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
4123
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
4224

43-
## Contribute
25+
# Contribute
4426

4527
Contributions welcome! Please check out [the issues](https://github.com/ipfs/js-stores/issues).
4628

packages/blockstore-fs/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
"eslintConfig": {
5656
"extends": "ipfs",
5757
"parserOptions": {
58-
"sourceType": "module",
5958
"project": [
6059
"tsconfig.json",
6160
"benchmarks/encoding/tsconfig.json"
62-
]
61+
],
62+
"sourceType": "module"
6363
}
6464
},
6565
"release": {
@@ -168,7 +168,7 @@
168168
"multiformats": "^12.0.1"
169169
},
170170
"devDependencies": {
171-
"aegir": "^40.0.8",
171+
"aegir": "^41.1.9",
172172
"interface-blockstore-tests": "^6.0.0"
173173
}
174174
}

packages/blockstore-fs/src/index.ts

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/**
2+
* @packageDocumentation
3+
*
4+
* A Blockstore implementation that stores blocks in the local filesystem.
5+
*
6+
* @example
7+
*
8+
* ```js
9+
* import { FsBlockstore } from 'blockstore-fs'
10+
*
11+
* const store = new FsBlockstore('path/to/store')
12+
* ```
13+
*/
14+
115
import fs from 'node:fs/promises'
216
import path from 'node:path'
317
import { promisify } from 'node:util'

packages/blockstore-fs/src/sharding.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import type { MultibaseCodec } from 'multiformats/bases/interface'
55

66
export interface ShardingStrategy {
77
extension: string
8-
encode: (cid: CID) => { dir: string, file: string }
9-
decode: (path: string) => CID
8+
encode(cid: CID): { dir: string, file: string }
9+
decode(path: string): CID
1010
}
1111

1212
export interface NextToLastInit {

0 commit comments

Comments
 (0)