1. 10 Feb, 2020 1 commit
  2. 05 Feb, 2020 1 commit
    • Steven Allen's avatar
      fix(key): only count a key as an ancestor or prefix if there is a separator · 5598edf1
      Steven Allen authored
      Also make sure to clean and normalize keys before using them as prefixes.
      
      BREAKING CHANGES:
      
      * `myds.Query(Query{Prefix:"/foo"})` will no longer match "/foobar" (or even
        "/foo"). This is usually what the user expects, we had a tendency to normalize
        "/foo/" to "/foo" (when we clean keys), and many datastores can't efficiently
        search for prefixes that aren't on path-boundaries anyways.
      * Given a mount datastore with mounts `["/foo", "/"]`, `myds.Put("/foo", "bar")`
        will put the value to the datastore mounted at "/", not "/foo", as the key "/"
        and "" usually doesn't make sense.
      
      While technically breaking, these changes are much more likely to fix bugs than
      they are to break things.
      5598edf1
  3. 05 Dec, 2019 1 commit
  4. 03 Dec, 2019 1 commit
  5. 22 Nov, 2019 2 commits
  6. 27 Sep, 2019 1 commit
  7. 29 Aug, 2019 1 commit
    • Steven Allen's avatar
      feat: make not-found errors discoverable · 473787bf
      Steven Allen authored
      Now we just need a common place to put:
      
      func IsNotFound(e error) bool {
        for e != nil {
          if ne, ok := e.(interface { NotFound() bool }); ok {
            return ne.NotFound()
          }
          if ue, ok := e.(interface { Unwrap() error }); ok {
            e = ue.Unwrap()
          } else {
            return false
          }
        }
        return false
      }
      473787bf
  8. 21 Aug, 2019 1 commit
  9. 22 Mar, 2019 6 commits
  10. 21 Mar, 2019 2 commits
  11. 20 Mar, 2019 2 commits
  12. 15 Mar, 2019 1 commit
    • Steven Allen's avatar
      remove ThreadSafeDatastore · 9f529bc3
      Steven Allen authored
      It's a lie! We:
      
      1. Assume that our datastores are thread-safe all over the place, not bothering
         to check for this interface.
      2. Implement this interface for, e.g., the mount datastore that _may not_ be
         thread-safe (depending on the sub-datastores).
      
      Basically, there's no sane way to to do something like this in go. What we
      _want_ is:
      
      ```rust
      pub trait ThreadSafe {}
      
      struct MyWrapper<D: Datastore> { ... }
      
      impl<D: Datastore> ThreadSafe for MyWrapper<D> where D: ThreadSafe {}
      ```
      
      Actually, we don't even need this because rust has already done all the hard
      work with the `Sync` trait.
      
      ....
      
      But we're using go which barely has types.
      
      ---
      
      For completeness, it's actually possible to do this in go:
      
      ```go
      type threadSafeMixin struct{}
      func (threadSafeMixin) ThreadSafe() {}
      
      func NewWrapper(d Datastore) Datastore {
        if _, ok := d.(ThreadSafe) {
          return &struct{myWrapper, threadSafeMixin}{myWrapper{d}, threadSafeMixin{}}
        }
        return &myWrapper{d}
      }
      ```
      
      Let's not.
      9f529bc3
  13. 28 Jan, 2019 1 commit
  14. 04 Oct, 2018 1 commit
    • Steven Allen's avatar
      add a GetSize method · 1cd3a342
      Steven Allen authored
      We can also add this as an extension but it's simple enough I'd like to add it
      directly to the Datastore.
      
      Use-case: The blockstore now has a GetSize and bitswap uses it for packing
      multiple blocks into a single message. Unfortunately, this means that bitswap is
      now calling blockstore.GetSize which calls datastore.Get which tends to be more
      expensive than datastore.Has.
      1cd3a342
  15. 13 Aug, 2018 1 commit
  16. 26 Jan, 2018 1 commit
  17. 24 Jan, 2018 1 commit
  18. 23 Jan, 2018 1 commit
  19. 14 Oct, 2017 1 commit
  20. 03 Jul, 2017 1 commit
  21. 28 Jun, 2017 1 commit
  22. 27 Jun, 2017 1 commit
  23. 01 Jan, 2016 1 commit
  24. 17 Jul, 2015 1 commit
  25. 16 Jul, 2015 1 commit
  26. 02 Jul, 2015 1 commit
    • Jeromy's avatar
      add in support for batched writes · df0989a3
      Jeromy authored
      implement batch ops for different datastore types
      
      rename Transaction to Batch
      
      Revert "add in support for batched writes"
      
      add in benchmarks for put and batchput
      
      move batching into separate interface
      
      address concerns from PR
      
      regrab old code
      df0989a3
  27. 27 Jun, 2015 1 commit
  28. 26 Jun, 2015 2 commits
  29. 16 Mar, 2015 3 commits