vole/vole — pull request #27 by marktheunissen (2013-05-26 21:30:54+00:00)
Title: Users have IDs

Alright, lots of refactoring here. The new `lib/store` replaces the `db.go` file.

The most coolest thing is that there is now test coverage for the store. Start by grabbing the branch, then do:

`go test -v lib/store`

This creates a new Vole store in `~/VoleTest` and runs all the tests which start by setting up users, then create posts, load posts, etc. By the end of the test run, you have a nice set of sample data in `~/VoleTest` to inspect.

The main app is now using ~/VoleTest so you can open it up as usual using `make` and then see the test data that was created by the test run, and you can add to it or do whatever by posting or making more users. I haven't gotten around to reading the data dir from the config file, that should be done I guess.

Reading the tests might be the best way to get a feel for what I've changed in general, but:

1. Creating a user makes a folder `"name_uuid"` in the /users directory. This uuid is not used in lookups, however. The directory can still be any name, which allows us to create directories and add them to bittorrent sync with only the bt sync read-only key. I.e. You don't have to know the user's unique ID to add them to your Vole folder.
2. The my_user file now has the subdirectory's name that contains my user. Instead of just the user handle.
3. Files now have .json extension to avoid DS_Store nightmare and other junk seeping in.
4. Posts now "belong" to users in a more fundamental way... difficult to describe. See code. :D
5. User gravatars are now delivered with post details, making displaying the avatars easy on the home view (this is done). The @example.com gravatars are hilarious.

There is probably a lot of tweaking and fine tuning but thought this was a good point to stop.