Containers

I'm trying to move fairly rapidly here towards a stable client interface that I'm happy with. I'm focusing on refining the interface, with just enough implementation to test it. The actual implementation here is just mostly scaffolding which is why I'm letting myself roll this into a big changeset.

I'd like to highlight some key points though.

Take a look at [Blob]. I've introduced the single-method Named and Sized interfaces. Small very generic interfaces is a habit I've picked up from Clojure. I'm just itching for an excuse to split out a Readable interface too so that Blob is literally just the definition "named, sized and readable". I won't do it though until I'm certain there will be another use of the Readable interface.  Premature generalisation can be just as evil as premature optimisation.

[Blob]:https://github.com/nla/doss/blob/5e8f3a6ada9ca861f623f4b81b8a44a315a5e554/src/doss/Blob.java

Speaking of which the IdGenerator interface is now gone. I'm never expecting to support multiple id schemes so it was silly to introduce it. Instead we have a [RunningNumber] class. It's getting closer but will be revisted again.

[RunningNumber]:https://github.com/nla/doss/blob/5e8f3a6ada9ca861f623f4b81b8a44a315a5e554/src/doss/local/RunningNumber.java

You can see I keep flip-flopping on whether the ids should be a string or a long. I want them to be a string as that somewhat better embodies their purpose. I want them to be a long so that you can do performance tricks with them. Generalization warring with optimization. I considered a dedicated id type and if Java had one (like lisp's symbol type) I'd use it but the whole point of them is they should be convenient to work with. Blob.id().toString() would just be silly.

I did introduce the [Container] interface here.  That's also a little premature but like BlobStore I'm very confident there will be multiple implementations so I'm not too worried about it yet.  Container is in the doss.local package for now as it's not part of the client API.  At some stage it will probably move into a separate package for an administrative API. It's also going to grow a bit.

[Container]:https://github.com/nla/doss/blob/5e8f3a6ada9ca861f623f4b81b8a44a315a5e554/src/doss/local/Container.java

I introduce the [BlobIndex] slightly prematurely but I know there will be at least two implementations: an in-memory one for testing and a durable one probably initially backed by MySQL. Again it'll move into the administrative API.

[BlobIndex]:https://github.com/nla/doss/blob/5e8f3a6ada9ca861f623f4b81b8a44a315a5e554/src/doss/local/BlobIndex.java

Finally there's a couple of naming cleanups: ChannelOuput becomes Writable and blob.getId() becomes blob.id(). More about my motivation for naming changes in this essay:

https://gist.github.com/ato/86ce1ebed82c9028d31d