@@ -9,13 +9,13 @@ import { Key } from 'interface-datastore'
99import { ShardingDatastore , shard } from 'datastore-core'
1010import { isNode , isElectronMain } from 'ipfs-utils/src/env.js'
1111import { interfaceDatastoreTests } from 'interface-datastore-tests'
12- import { DatastoreFs } from '../src/index.js'
12+ import { FsDatastore } from '../src/index.js'
1313import tempdir from 'ipfs-utils/src/temp-dir.js'
1414
1515const rimraf = promisify ( rmrf )
1616const utf8Encoder = new TextEncoder ( )
1717
18- describe ( 'DatastoreFs ' , ( ) => {
18+ describe ( 'FsDatastore ' , ( ) => {
1919 if ( ! ( isNode || isElectronMain ) ) {
2020 it ( 'only supports node.js and electron main' , ( ) => {
2121
@@ -28,23 +28,23 @@ describe('DatastoreFs', () => {
2828 it ( 'defaults - folder missing' , ( ) => {
2929 const dir = tempdir ( )
3030 expect (
31- ( ) => new DatastoreFs ( dir )
31+ ( ) => new FsDatastore ( dir )
3232 ) . to . not . throw ( )
3333 } )
3434
3535 it ( 'defaults - folder exists' , ( ) => {
3636 const dir = tempdir ( )
3737 mkdirp . sync ( dir )
3838 expect (
39- ( ) => new DatastoreFs ( dir )
39+ ( ) => new FsDatastore ( dir )
4040 ) . to . not . throw ( )
4141 } )
4242 } )
4343
4444 describe ( 'open' , ( ) => {
4545 it ( 'createIfMissing: false - folder missing' , ( ) => {
4646 const dir = tempdir ( )
47- const store = new DatastoreFs ( dir , { createIfMissing : false } )
47+ const store = new FsDatastore ( dir , { createIfMissing : false } )
4848 expect (
4949 ( ) => store . open ( )
5050 ) . to . throw ( )
@@ -53,7 +53,7 @@ describe('DatastoreFs', () => {
5353 it ( 'errorIfExists: true - folder exists' , ( ) => {
5454 const dir = tempdir ( )
5555 mkdirp . sync ( dir )
56- const store = new DatastoreFs ( dir , { errorIfExists : true } )
56+ const store = new FsDatastore ( dir , { errorIfExists : true } )
5757 expect (
5858 ( ) => store . open ( )
5959 ) . to . throw ( )
@@ -62,7 +62,7 @@ describe('DatastoreFs', () => {
6262
6363 it ( '_encode and _decode' , ( ) => {
6464 const dir = tempdir ( )
65- const fs = new DatastoreFs ( dir )
65+ const fs = new FsDatastore ( dir )
6666
6767 expect (
6868 // @ts -ignore
@@ -82,7 +82,7 @@ describe('DatastoreFs', () => {
8282
8383 it ( 'deleting files' , async ( ) => {
8484 const dir = tempdir ( )
85- const fs = new DatastoreFs ( dir )
85+ const fs = new FsDatastore ( dir )
8686 const key = new Key ( '1234' )
8787
8888 await fs . put ( key , Uint8Array . from ( [ 0 , 1 , 2 , 3 ] ) )
@@ -98,7 +98,7 @@ describe('DatastoreFs', () => {
9898
9999 it ( 'deleting non-existent files' , async ( ) => {
100100 const dir = tempdir ( )
101- const fs = new DatastoreFs ( dir )
101+ const fs = new FsDatastore ( dir )
102102 const key = new Key ( '5678' )
103103
104104 await fs . delete ( key )
@@ -113,7 +113,7 @@ describe('DatastoreFs', () => {
113113
114114 it ( 'sharding files' , async ( ) => {
115115 const dir = tempdir ( )
116- const fstore = new DatastoreFs ( dir )
116+ const fstore = new FsDatastore ( dir )
117117 await ShardingDatastore . create ( fstore , new shard . NextToLast ( 2 ) )
118118
119119 const file = await fs . promises . readFile ( path . join ( dir , shard . SHARDING_FN ) )
@@ -125,7 +125,7 @@ describe('DatastoreFs', () => {
125125 } )
126126
127127 it ( 'query' , async ( ) => {
128- const fs = new DatastoreFs ( path . join ( process . cwd ( ) , '/test/test-repo/blocks' ) )
128+ const fs = new FsDatastore ( path . join ( process . cwd ( ) , '/test/test-repo/blocks' ) )
129129 const res = [ ]
130130 for await ( const q of fs . query ( { } ) ) {
131131 res . push ( q )
@@ -135,7 +135,7 @@ describe('DatastoreFs', () => {
135135
136136 it ( 'interop with go' , async ( ) => {
137137 const repodir = path . join ( process . cwd ( ) , '/test/test-repo/blocks' )
138- const fstore = new DatastoreFs ( repodir )
138+ const fstore = new FsDatastore ( repodir )
139139 const key = new Key ( 'CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY' )
140140 const expected = fs . readFileSync ( path . join ( repodir , 'VO' , key . toString ( ) + '.data' ) )
141141 const flatfs = await ShardingDatastore . open ( fstore )
@@ -152,7 +152,7 @@ describe('DatastoreFs', () => {
152152
153153 interfaceDatastoreTests ( {
154154 setup : ( ) => {
155- return new DatastoreFs ( dir )
155+ return new FsDatastore ( dir )
156156 } ,
157157 teardown : ( ) => {
158158 return rimraf ( dir )
@@ -165,7 +165,7 @@ describe('DatastoreFs', () => {
165165
166166 interfaceDatastoreTests ( {
167167 setup : ( ) => {
168- return new ShardingDatastore ( new DatastoreFs ( dir ) , new shard . NextToLast ( 2 ) )
168+ return new ShardingDatastore ( new FsDatastore ( dir ) , new shard . NextToLast ( 2 ) )
169169 } ,
170170 teardown : ( ) => {
171171 return rimraf ( dir )
@@ -175,7 +175,7 @@ describe('DatastoreFs', () => {
175175
176176 it ( 'can survive concurrent writes' , async ( ) => {
177177 const dir = tempdir ( )
178- const fstore = new DatastoreFs ( dir )
178+ const fstore = new FsDatastore ( dir )
179179 const key = new Key ( 'CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY' )
180180 const value = utf8Encoder . encode ( 'Hello world' )
181181
@@ -190,7 +190,7 @@ describe('DatastoreFs', () => {
190190
191191 it ( 'can survive putRaw and getRaw with an empty extension' , async ( ) => {
192192 const dir = tempdir ( )
193- const fstore = new DatastoreFs ( dir , {
193+ const fstore = new FsDatastore ( dir , {
194194 extension : ''
195195 } )
196196 const key = new Key ( 'CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY' )
0 commit comments