• Brian Tiger Chow's avatar
    fix(fsrepo/datastore) allow goroutines to share the datastore. · bc76d2e5
    Brian Tiger Chow authored
    doh! I forgot to make sure leveldb is only opened once. thanks for catching this @mappum
    
    * You may be wondering why we don't just share pointers to FSRepos. We
      want to manage the lifecycle of the FSRepo by tracking its `state`.
      Thus each FSRepo/goroutine requires private instance variables. For
      this reason, each `fsrepo.At(p)` caller must get its own goroutine.
    
    * There's a test in `fsrepo` because callers desire the ability to Open
      from multiple goroutines. There's a test in `component` because this
      is where the actual work needs to go in order to provide the desired
      contract. If the `component` package moves, the assurances need to
      move along with it.
    
    cc @whyrusleeping @jbenet
    
    side note: there are a couple packages in FSRepo that it might be
    worthwhile to extract once the dust settles on this feature-set.
    bc76d2e5
datastore.go 3.4 KB