Skip to content

Commit f550624

Browse files
Marcel-Gaegir[bot]achingbrain
authored
fix: cleanup references to datastore in blockstores (#274)
Docs code comments and specs refer to datastores within blockstore packages. Theres also as small change to an error and exported type e3302b6 --------- Co-authored-by: aegir[bot] <aegir[bot]@users.noreply.github.com> Co-authored-by: Alex Potsides <[email protected]>
1 parent be4f27d commit f550624

File tree

15 files changed

+67
-35
lines changed

15 files changed

+67
-35
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('Tiered', () => {
5454
})
5555
})
5656

57-
describe('inteface-datastore-single', () => {
57+
describe('inteface-blockstore-single', () => {
5858
interfaceBlockstoreTests({
5959
setup () {
6060
return new TieredBlockstore([

packages/blockstore-fs/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export class FsBlockstore implements Blockstore {
257257

258258
yield pair
259259
} catch (err: any) {
260-
// if keys are removed from the datastore while the query is
260+
// if keys are removed from the blockstore while the query is
261261
// running, we may encounter missing files.
262262
if (err.code !== 'ENOENT') {
263263
throw err

packages/blockstore-idb/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type { Pair } from 'interface-blockstore'
2525
import type { AbortOptions, AwaitIterable } from 'interface-store'
2626
import type { MultibaseCodec } from 'multiformats/bases/interface'
2727

28-
export interface IDBDatastoreInit {
28+
export interface IDBBlockstoreInit {
2929
/**
3030
* A prefix to use for all database keys (default: '')
3131
*/
@@ -49,7 +49,7 @@ export class IDBBlockstore extends BaseBlockstore {
4949
private db?: IDBPDatabase
5050
private readonly base: MultibaseCodec<string>
5151

52-
constructor (location: string, init: IDBDatastoreInit = {}) {
52+
constructor (location: string, init: IDBBlockstoreInit = {}) {
5353
super()
5454

5555
this.location = `${init.prefix ?? ''}${location}`

packages/blockstore-level/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface LevelBlockstoreInit extends DatabaseOptions<string, Uint8Array>
3434
}
3535

3636
/**
37-
* A datastore backed by leveldb
37+
* A blockstore backed by leveldb
3838
*/
3939
export class LevelBlockstore extends BaseBlockstore {
4040
public db: Level<string, Uint8Array>

packages/blockstore-level/test/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { interfaceBlockstoreTests } from 'interface-blockstore-tests'
77
import tempdir from 'ipfs-utils/src/temp-dir.js'
88
import { LevelBlockstore } from '../src/index.js'
99

10-
describe('LevelDatastore', () => {
10+
describe('LevelBlockstore', () => {
1111
describe('interface-blockstore (leveldown)', () => {
1212
interfaceBlockstoreTests({
1313
async setup () {

packages/blockstore-s3/README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,22 @@ A Blockstore implementation that stores blocks on Amazon S3.
1414
If the flag `createIfMissing` is not set or is false, then the bucket must be created prior to using blockstore-s3. Please see the AWS docs for information on how to configure the S3 instance. A bucket name is required to be set at the s3 instance level, see the below example.
1515

1616
```js
17-
import S3 from 'aws-sdk/clients/s3.js'
17+
import { S3 } from '@aws-sdk/client-s3'
1818
import { S3Blockstore } from 'blockstore-s3'
1919

20-
const s3Instance = new S3({ params: { Bucket: 'my-ipfs-bucket' } })
21-
const store = new S3Blockstore('.ipfs/datastore', {
22-
s3: s3Instance
23-
createIfMissing: false
20+
const s3 = new S3({
21+
region: 'region',
22+
credentials: {
23+
accessKeyId: 'myaccesskey',
24+
secretAccessKey: 'mysecretkey'
25+
}
2426
})
27+
28+
const store = new S3Blockstore(
29+
s3,
30+
'my-bucket',
31+
{ createIfMissing: false }
32+
)
2533
```
2634

2735
## Example

packages/blockstore-s3/examples/helia/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Use with Helia
22
======
33

4-
This example uses a Datastore S3 instance to serve as the entire backend for Helia.
4+
This example uses a Blockstore S3 instance to serve as the entire backend for Helia.
55

66
## Running
77
The S3 parameters must be updated with an existing Bucket and credentials with access to it:
@@ -15,7 +15,7 @@ const s3 = new S3({
1515
}
1616
})
1717

18-
const datastore = new DatastoreS3(s3, 'my-bucket')
18+
const blockstore = new BlockstoreS3(s3, 'my-bucket')
1919
```
2020

2121
Once the S3 instance has its needed data, you can run the example:

packages/blockstore-s3/examples/helia/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createHelia } from 'helia'
22
import { unixfs } from '@helia/unixfs'
33
import toBuffer from 'it-to-buffer'
44
import { S3 } from '@aws-sdk/client-s3'
5-
import { DatastoreS3 } from 'datastore-s3'
5+
import { BlockstoreS3 } from 'blockstore-s3'
66

77
async function main () {
88
// Configure S3 as normal
@@ -14,12 +14,12 @@ async function main () {
1414
}
1515
})
1616

17-
const datastore = new DatastoreS3(s3, 'my-bucket')
17+
const blockstore = new BlockstoreS3(s3, 'my-bucket')
1818

1919
// Create a new Helia node with our S3 backed Repo
2020
console.log('Start Helia')
2121
const node = await createHelia({
22-
datastore
22+
blockstore
2323
})
2424

2525
// Test out the repo by sending and fetching some data

packages/blockstore-s3/examples/helia/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"dependencies": {
1313
"@aws-sdk/client-s3": "^3.297.0",
1414
"@helia/unixfs": "^1.2.0",
15-
"datastore-s3": "../../",
15+
"blockstore-s3": "../../",
1616
"helia": "^1.0.0",
1717
"it-to-buffer": "^3.0.1"
1818
}

packages/blockstore-s3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"url": "https://github.com/ipfs/js-stores/issues"
1313
},
1414
"keywords": [
15-
"datastore",
15+
"blockstore",
1616
"interface",
1717
"ipfs",
1818
"key-value",

0 commit comments

Comments
 (0)