Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki authored Dec 14, 2023
2 parents 12d5d8e + 7dad9a4 commit 092e344
Show file tree
Hide file tree
Showing 76 changed files with 1,144 additions and 683 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Semantic PR

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
uses: pl-strflt/.github/.github/workflows/reusable-semantic-pull-request.yml@v0.3
22 changes: 4 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
# stores <!-- omit in toc -->

[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores)
[![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)

> Blockstores and datastores used by IP-JS internals
## Table of contents <!-- omit in toc -->

- [Structure](#structure)
- [Packages](#packages)
- [API Docs](#api-docs)
- [License](#license)
- [Contribute](#contribute)

## Structure
# 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
Expand All @@ -33,22 +23,18 @@
- [`/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

See the [./packages](./packages) directory for the various interfaces.

## API Docs
# API Docs

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

## License
# License

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>)

## Contribute
# Contribute

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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"release": "npm run docs:no-publish && aegir run release && npm run docs"
},
"devDependencies": {
"aegir": "^40.0.8"
"aegir": "^41.1.9"
},
"workspaces": [
"packages/*"
Expand Down
33 changes: 33 additions & 0 deletions packages/blockstore-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
## [blockstore-core-v4.3.8](https://github.com/ipfs/js-stores/compare/blockstore-core-v4.3.7...blockstore-core-v4.3.8) (2023-12-08)


### Dependencies

* bump uint8arrays from 4.0.10 to 5.0.0 ([#282](https://github.com/ipfs/js-stores/issues/282)) ([2cbfd52](https://github.com/ipfs/js-stores/commit/2cbfd52257e9358786962d94e144df9583a45c30))

## [blockstore-core-v4.3.7](https://github.com/ipfs/js-stores/compare/blockstore-core-v4.3.6...blockstore-core-v4.3.7) (2023-12-01)


### Bug Fixes

* cleanup references to datastore in blockstores ([#274](https://github.com/ipfs/js-stores/issues/274)) ([f550624](https://github.com/ipfs/js-stores/commit/f5506243b2cb1e6462457241a1614bd5f0755c12))

## [blockstore-core-v4.3.6](https://github.com/ipfs/js-stores/compare/blockstore-core-v4.3.5...blockstore-core-v4.3.6) (2023-12-01)


### Dependencies

* bump @libp2p/logger from 3.1.0 to 4.0.1 ([#280](https://github.com/ipfs/js-stores/issues/280)) ([ab4731f](https://github.com/ipfs/js-stores/commit/ab4731f49a1a6f9163fb9c246121b3392503ba8b))

## [blockstore-core-v4.3.5](https://github.com/ipfs/js-stores/compare/blockstore-core-v4.3.4...blockstore-core-v4.3.5) (2023-11-27)


### Documentation

* update datastore core readme and package config ([#245](https://github.com/ipfs/js-stores/issues/245)) ([c08d29a](https://github.com/ipfs/js-stores/commit/c08d29ab18ddea26a1d9dd73d673847469d28a13))


### Dependencies

* **dev:** bump aegir from 40.0.13 to 41.1.9 ([#268](https://github.com/ipfs/js-stores/issues/268)) ([0aa0944](https://github.com/ipfs/js-stores/commit/0aa0944d42798d1f6fd589e8a58de7d791760644))

## [blockstore-core-v4.3.4](https://github.com/ipfs/js-stores/compare/blockstore-core-v4.3.3...blockstore-core-v4.3.4) (2023-09-05)


Expand Down
91 changes: 5 additions & 86 deletions packages/blockstore-core/README.md
Original file line number Diff line number Diff line change
@@ -1,117 +1,36 @@
# blockstore-core <!-- omit in toc -->

[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores)
[![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)

> Contains various implementations of the API contract described in interface-blockstore
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Browser `<script>` tag](#browser-script-tag)
- [Implementations](#implementations)
- [Usage](#usage)
- [BaseBlockstore](#baseblockstore)
- [MemoryBlockstore](#memoryblockstore)
- [BlackHoleBlockstore](#blackholeblockstore)
- [TieredBlockstore](#tieredblockstore)
- [API Docs](#api-docs)
- [License](#license)
- [Contribute](#contribute)

## Install
# Install

```console
$ npm i blockstore-core
```

### Browser `<script>` tag
## Browser `<script>` tag

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

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

## Implementations

- Base: [`src/base`](src/base.ts)
- Memory: [`src/memory`](src/memory.ts)
- BlackHole: ['src/black-hole](src/black-hole.ts)
- Tiered: ['src/tiered](src/tiered.ts)

## Usage

### BaseBlockstore

Provides a complete implementation of the Blockstore interface. You must implement `.get`, `.put`, etc.

```js
import { BaseBlockstore } from 'blockstore-core/base'

class MyCustomBlockstore extends BaseBlockstore {
put (key, val, options) {
// store a block
}

get (key, options) {
// retrieve a block
}

// ...etc
}
```

### MemoryBlockstore

A simple Blockstore that stores blocks in memory.

```js
import { MemoryBlockstore } from 'blockstore-core/memory'

const store = new MemoryBlockstore()
```

### BlackHoleBlockstore

A Blockstore that does not store any blocks.

```js
import { BlackHoleBlockstore } from 'blockstore-core/black-hole'

const store = new BlackHoleBlockstore()
```

### TieredBlockstore

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.

Writes are invoked on all wrapped blockstores.

```js
import { TieredBlockstore } from 'blockstore-core/tiered'

const store = new TieredBlockstore([
store1,
store2,
// ...etc
])
```

## API Docs
# API Docs

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

## License
# License

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>)

## Contribute
# Contribute

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

Expand Down
9 changes: 5 additions & 4 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.3.4",
"version": "4.3.8",
"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 @@ -71,6 +71,7 @@
"eslintConfig": {
"extends": "ipfs",
"parserOptions": {
"project": true,
"sourceType": "module"
}
},
Expand Down Expand Up @@ -174,7 +175,7 @@
"dep-check": "aegir dep-check"
},
"dependencies": {
"@libp2p/logger": "^3.0.0",
"@libp2p/logger": "^4.0.1",
"err-code": "^3.0.1",
"interface-blockstore": "^5.0.0",
"interface-store": "^5.0.0",
Expand All @@ -183,10 +184,10 @@
"it-merge": "^3.0.1",
"it-pushable": "^3.0.0",
"multiformats": "^12.0.1",
"uint8arrays": "^4.0.2"
"uint8arrays": "^5.0.0"
},
"devDependencies": {
"aegir": "^40.0.8",
"aegir": "^41.1.9",
"interface-blockstore-tests": "^6.0.0"
}
}
69 changes: 69 additions & 0 deletions packages/blockstore-core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,72 @@
/**
* @packageDocumentation
*
* Various Blockstore implementations are available.
*
* ## Implementations
*
* - Base: [`src/base`](src/base.ts)
* - Memory: [`src/memory`](src/memory.ts)
* - BlackHole: ['src/black-hole](src/black-hole.ts)
* - Tiered: ['src/tiered](src/tiered.ts)
*
* @example BaseBlockstore
*
* Provides a complete implementation of the Blockstore interface. You must implement `.get`, `.put`, etc.
*
* ```js
* import { BaseBlockstore } from 'blockstore-core/base'
*
* class MyCustomBlockstore extends BaseBlockstore {
* put (key, val, options) {
* // store a block
* }
*
* get (key, options) {
* // retrieve a block
* }
*
* // ...etc
* }
* ```
*
* @example MemoryBlockstore
*
* A simple Blockstore that stores blocks in memory.
*
* ```js
* import { MemoryBlockstore } from 'blockstore-core/memory'
*
* const store = new MemoryBlockstore()
* ```
*
* @example BlackHoleBlockstore
*
* A Blockstore that does not store any blocks.
*
* ```js
* import { BlackHoleBlockstore } from 'blockstore-core/black-hole'
*
* const store = new BlackHoleBlockstore()
* ```
*
* @example TieredBlockstore
*
* 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.
*
* Writes are invoked on all wrapped blockstores.
*
* ```js
* import { TieredBlockstore } from 'blockstore-core/tiered'
*
* const store = new TieredBlockstore([
* store1,
* store2,
* // ...etc
* ])
* ```
*/

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

export { BaseBlockstore } from './base.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/blockstore-core/test/memory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { interfaceBlockstoreTests } from 'interface-blockstore-tests'
import { MemoryBlockstore } from '../src/memory.js'

describe('memory', () => {
describe('interface-datastore', () => {
describe('interface-blockstore', () => {
interfaceBlockstoreTests({
setup () {
return new MemoryBlockstore()
Expand Down
2 changes: 1 addition & 1 deletion packages/blockstore-core/test/tiered.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Tiered', () => {
})
})

describe('inteface-datastore-single', () => {
describe('inteface-blockstore-single', () => {
interfaceBlockstoreTests({
setup () {
return new TieredBlockstore([
Expand Down
19 changes: 19 additions & 0 deletions packages/blockstore-fs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## [blockstore-fs-v1.1.8](https://github.com/ipfs/js-stores/compare/blockstore-fs-v1.1.7...blockstore-fs-v1.1.8) (2023-12-01)


### Bug Fixes

* cleanup references to datastore in blockstores ([#274](https://github.com/ipfs/js-stores/issues/274)) ([f550624](https://github.com/ipfs/js-stores/commit/f5506243b2cb1e6462457241a1614bd5f0755c12))

## [blockstore-fs-v1.1.7](https://github.com/ipfs/js-stores/compare/blockstore-fs-v1.1.6...blockstore-fs-v1.1.7) (2023-11-27)


### Documentation

* update datastore core readme and package config ([#245](https://github.com/ipfs/js-stores/issues/245)) ([c08d29a](https://github.com/ipfs/js-stores/commit/c08d29ab18ddea26a1d9dd73d673847469d28a13))


### Dependencies

* **dev:** bump aegir from 40.0.13 to 41.1.9 ([#268](https://github.com/ipfs/js-stores/issues/268)) ([0aa0944](https://github.com/ipfs/js-stores/commit/0aa0944d42798d1f6fd589e8a58de7d791760644))

## [blockstore-fs-v1.1.6](https://github.com/ipfs/js-stores/compare/blockstore-fs-v1.1.5...blockstore-fs-v1.1.6) (2023-09-05)


Expand Down
Loading

0 comments on commit 092e344

Please sign in to comment.