Commit Graph

2843 Commits

Author SHA1 Message Date
Brian Tiger Chow
bc76d2e526 fix(fsrepo/datastore) allow goroutines to share the datastore.
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.
2015-01-14 18:23:15 -08:00
Brian Tiger Chow
440de64d97 refactor(fsrepo/test) extract assert
@jbenet will move in upcoming branch/PR
2015-01-14 18:22:25 -08:00
Brian Tiger Chow
2fc97ad896 Merge pull request #564 from jbenet/feat/eventlogBeginDone
feat(eventlog): e := EventBegin; e.Done()
2015-01-14 17:56:50 -08:00
Brian Tiger Chow
b252d0450d feat(eventlog): e := EventBegin; e.Done()
```Go
e := log.EventBegin(ctx, "provide")
e.Done()

e := log.EventBegin(ctx, "provide")
e.Close() // implements io.Closer in case you want to register with some lifecycle management system.
```
2015-01-14 17:55:28 -08:00
Juan Batiz-Benet
f70c57d8d2 Merge pull request #562 from jbenet/net-diag-d3
more d3 niceness.
2015-01-14 16:56:29 -08:00
Matt Bell
01cca5bfe2 diagnostics/d3: Added link highlighting 2015-01-14 16:48:50 -08:00
Brian Tiger Chow
47701aaa2b Merge pull request #566 from jbenet/races
race fixes
2015-01-14 16:35:34 -08:00
Juan Batiz-Benet
a14d77e368 diagnostics/d3: node sizes 2015-01-14 16:16:26 -08:00
Juan Batiz-Benet
16690d4af2 race fix: pinner loads with a threadsafe datastore
All the datastores used by pinners and so on should be mutex
wrapped. One issue with changing all of them from
ds.Datastore -> ds.ThreadSafeDatastore is that we wrap the
incoming ds.ThreadSafeDatastore with other datastores, which
do not implement the interface. Re-wrapping again causes
double locking. (which may be ok..., but...) any ideas?
2015-01-14 16:15:38 -08:00
Juan Batiz-Benet
4af5d85fac Merge pull request #565 from jbenet/ci-pkgs
testutil ci pkgs check env vars
2015-01-14 16:15:15 -08:00
Brian Tiger Chow
50047dcf27 Update jenkins.go 2015-01-14 16:07:26 -08:00
Juan Batiz-Benet
0311c0518d testing/ci: all env var checks now use new pkgs
Good thing, i checked one wrong, too!
2015-01-14 16:01:03 -08:00
Juan Batiz-Benet
73b3c30452 ci-pkgs: added travis and jenkins ci pkgs 2015-01-14 15:37:10 -08:00
Juan Batiz-Benet
01283b92f7 Merge pull request #556 from jbenet/net-diag-viewer
diag/net: visualizing in d3 and dot
2015-01-14 10:32:56 -08:00
Juan Batiz-Benet
a2cee3f165 diagnostics/d3: added # of conns 2015-01-14 10:29:55 -08:00
Brian Tiger Chow
2dd8eaae3f Merge pull request #559 from jbenet/feat/repo-fsrepo-filelock
refactor(fsrepo.FSRepo): manage the Datastore and daemon.lock
2015-01-14 10:20:47 -08:00
Brian Tiger Chow
bd1d8767eb doc(fsrepo): explain ConfigAt 2015-01-14 10:06:55 -08:00
Brian Tiger Chow
30a5aa9b04 feat(repo): expose the Datastore() in repo.Repo interface 2015-01-14 09:26:13 -08:00
Juan Batiz-Benet
dd409fb151 diagnostics/d3/view: added chord viewer hash 2015-01-14 09:23:48 -08:00
Brian Tiger Chow
12116dd6e4 style(fsrepo): rename to counter.Openers 2015-01-14 09:18:57 -08:00
Juan Batiz-Benet
b9f828e1e3 diagnostics: added chord viewer 2015-01-14 09:18:21 -08:00
Juan Batiz-Benet
2669479056 diagnostics/d3 viewer.html -> force.html 2015-01-14 09:17:48 -08:00
Brian Tiger Chow
b666163e52 test(fsrepo)PERF allow tests to run in parallel 2015-01-14 09:15:06 -08:00
Brian Tiger Chow
6396123b7f feat(fsrepo): expose Datastore in FSRepo interface (+ test) 2015-01-14 09:14:16 -08:00
Brian Tiger Chow
b685f92c95 test(fsrepo): InitIdempotence, NilRemoval, ReopeningDisallowed 2015-01-14 09:05:43 -08:00
Brian Tiger Chow
ece9ed0933 feat(fsrepo): integrate datastore component into FSRepo
"for each desired change, make the change easy (warning: this may be
hard), then make the easy change" - Kent Beck

https://twitter.com/KentBeck/status/250733358307500032

http://martinfowler.com/articles/preparatory-refactoring-example.html

cc @jbenet @whyrusleeping
2015-01-14 08:41:45 -08:00
Brian Tiger Chow
4ba4ee3a0d feat(fsrepo/component.datastore) basic shell 2015-01-14 08:41:45 -08:00
Brian Tiger Chow
7ad559b8c7 refactor(fsrepo, component): expose SetPath to ensure that components handle paths 2015-01-14 08:41:45 -08:00
Brian Tiger Chow
b660305142 extract initCheckDir to dir.Writable 2015-01-14 08:41:45 -08:00
Brian Tiger Chow
887fbe4a8e style(fsrepo) change func to method to be consistent 2015-01-14 08:41:45 -08:00
Brian Tiger Chow
9f67ede6b2 refactor(fsrepo) extract component.Component 2015-01-14 08:41:44 -08:00
Brian Tiger Chow
f37646bf19 refactor(fsrepo) add interface to make it easier to understand how to extend the package 2015-01-14 08:41:44 -08:00
Brian Tiger Chow
c364b4c34c refactor(fsrepo): extract configCompoenent
The struct was getting unmanageable. extracted the config component to
reduce complexity. The datastore will be written as another component.
2015-01-14 08:41:44 -08:00
Brian Tiger Chow
9acc02461e test(fsrepo) harden tests 2015-01-14 08:41:44 -08:00
Brian Tiger Chow
9a054c5800 doc(fsrepo) 2015-01-14 06:08:42 -08:00
Brian Tiger Chow
ac530d0ab6 refactor(fsrepo) move Close under Open 2015-01-14 06:08:36 -08:00
Brian Tiger Chow
70dab069bd doc(fsrepo) 2015-01-14 06:08:30 -08:00
Brian Tiger Chow
6ec60ba861 feat(fsrepo): document lock usage and make the fsrepo thread-safe
fix(fsrepo): extract private, unsynced method to prevent deadlock
2015-01-14 03:57:52 -08:00
Brian Tiger Chow
a3d2362691 use a single coarse package lock 2015-01-14 03:02:24 -08:00
Brian Tiger Chow
53e6a9bd1a fix(fsrepo): remove the Closer after closing it. 2015-01-14 03:02:23 -08:00
Brian Tiger Chow
6ec20b3574 huh 2015-01-14 03:02:23 -08:00
Brian Tiger Chow
76202a9444 fix(repo): clean the path before using it
no issue detected but it's good to be safe
2015-01-14 03:02:23 -08:00
Brian Tiger Chow
40e41d24f7 feat(fsrepo): protect with a repo lockfile
NB: daemon is one spot the repo lock is typically acquired
2015-01-14 03:02:23 -08:00
Brian Tiger Chow
67c161fb72 doc todo 2015-01-14 03:02:23 -08:00
Brian Tiger Chow
9700d2f94b use atomicfile for safer writes
for now, allow daemon and client to both hit config
2015-01-14 03:02:23 -08:00
Brian Tiger Chow
aacf871955 officially move to Go 1.4
@jbenet @whyrusleeping thoughts?
2015-01-14 03:02:22 -08:00
Brian Tiger Chow
acbd9a2204 rm unused function 2015-01-14 03:02:22 -08:00
Brian Tiger Chow
9a7fbe3210 doc(fsrepo): Roadmap 2015-01-14 03:02:22 -08:00
Juan Batiz-Benet
b8757d18ef diag/net: visualizing in d3 and dot
Try it out:

```
ipfs net diag --vis=d3 | diagnostics/d3/d3view
```

Notes: this is not the best way to do it, because it
breaks `--encoding=json`. Not sure what the best way is, and
right now this provides more utility than the other.
2015-01-13 23:49:35 -08:00
Juan Batiz-Benet
6959b4f032 p2p/net/swarm: fix travis env flag val
the travis docs say the env flag TRAVIS=true but, i want
to make absolutely sure. explicitness leaves less room for
error.
2015-01-13 23:34:28 -08:00