ipfs / go-ds-flatfs

A datastore implementation using sharded directories and flat files to store data
MIT License
46 stars 21 forks source link

Add NewDatastore entry point #83

Closed willscott closed 4 years ago

willscott commented 4 years ago

the fuzzer defaults to instantiating datastore implementations using NewDatastore, and interface method present in most of the other datastore implementations. Proposing adding here for ease of fuzzing.

Stebalien commented 4 years ago

Is there any way to avoid adding this to the public interface?

willscott commented 4 years ago

a manual stub for flatfs can be added in go-datastore/fuzz. It seems like since this repo a convention has emerged of naming the entry point NewDatastore, with functional store-specific options, versus the implementation specific entry point used by flatfs currently.

Stebalien commented 4 years ago

I don't think we're going to be able to define a good abstraction here:

willscott commented 4 years ago

interface{} was a placeholder for whatever option type we want - it could just as easily be a `ShardIdV1since that's the current option taken by flatfs. The point is to have it structured such that anil` parameter provides sane defaults, as in badger / leveldb / etc.

Point taken though, and I'll do this as a stub in the fuzz code.