Commit Graph

77 Commits

Author SHA1 Message Date
Brian Tiger Chow
faded48945 fix(config) use max backups to limit number of backups 2015-02-03 17:16:26 -08:00
Brian Tiger Chow
bbcbf46ce7 fix(repo/config) detect strings that represent ints 2015-02-03 17:19:19 -08:00
Brian Tiger Chow
bbc9715d4b fix(config, eventlog) use int. it plays nicely with everyone else 2015-02-03 17:19:15 -08:00
Brian Tiger Chow
d1da1d40c2 fix(repo/config) validate against struct before writing to disk
When setting config keys, the program doesn't know whether the
key-to-be-modified exists on the Config struct. (Perhaps, with
reflection, it is possible to find the field). To allow callers to write
non-existent keys, the program would...

Before:
1) converts the in-memory *Config to a map
2) sets the key on the map, and
3) writes this map to disk.
4) Then, it converts this map back into an in-memory struct.

This commit swaps 3 and 4 so the map can be validated against the struct
before being written to disk. This prevents the bug identified in #740.
2015-02-03 16:55:10 -08:00
Juan Batiz-Benet
d4257f9525 fsrepo: fix output to writer 2015-02-03 02:27:24 -08:00
Brian Tiger Chow
c48aef415f feat(config) default Log.MaxSizeMB = 500 2015-02-02 18:26:47 -08:00
Brian Tiger Chow
454cd454ea feat(fsrepo) add eventlog config to repo/config struct 2015-02-02 17:49:19 -08:00
Brian Tiger Chow
aefdda9c43 fix(fsrepo) don't enforce absolute path in datastore component
we only actually care that it isn't tidle'd ~
2015-02-01 21:54:20 -08:00
Juan Batiz-Benet
29bf59dded bootstrap: use ipfsaddr for boostrap peers ⚠️
⚠️ this commit makes your current configs unusable, as the
default bootstrap peers. You may need to edit your config.

Go from:

```js
Bootstrap: [
  {
    "Address": "/ip4/104.131.131.82/tcp/4001",
    "PeerID": "QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
  }
]
```

To:
```js
Bootstrap: [
  "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
]
```
2015-02-01 05:16:52 -08:00
Mildred Ki'Lya
7d09da3c8b Make gateway read-only by default and add option to make it writable 2015-01-31 23:36:45 +01:00
Juan Batiz-Benet
73234479fa init docs: go generated welcome dir + files
updated sharness hashes
2015-01-31 07:51:30 -08:00
Matt Bell
df97b968a1 cmd/ipfs: Add empty gateway object when initting config 2015-01-28 16:01:42 -08:00
Matt Bell
47774c5311 repo/config: Added Gateway options to config 2015-01-28 16:01:42 -08:00
Brian Tiger Chow
1ea9481a63 move config.Init into config package 2015-01-27 16:23:58 -08:00
Juan Batiz-Benet
45e4352c9c dropped down log.Errors 2015-01-26 19:13:44 -08:00
Brian Tiger Chow
98ad33e005 refactor(eventlog) integrate into fsrepo
now, eventlogger works wherever the fsrepo is used
2015-01-24 01:37:03 -08:00
Brian Tiger Chow
bb49b0191a use best known path method 2015-01-24 01:32:27 -08:00
Brian Tiger Chow
a5ee2efe43 move dir package 2015-01-24 01:32:27 -08:00
Brian Tiger Chow
df9e6ce640 refactor: rename IPFS_DIR -> IPFS_PATH
closes #394 https://github.com/jbenet/go-ipfs/issues/394
2015-01-21 17:09:39 -08:00
Brian Tiger Chow
5c4be75146 fix: init datastore in datastore/ subdirectory
@whyrusleeping @jbenet newly initialized datastores were being dumped
into ./go-ipfs. Eeek. An oversight during the FSRepo refactor. Not sure
how this bug survived this long.
2015-01-20 06:23:51 -08:00
Brian Tiger Chow
4b5ff960c9 feat(core): use repo.Repo in core constructor 2015-01-18 14:41:42 -08:00
Brian Tiger Chow
c9a89458a5 repo/mock: basic impl 2015-01-18 14:41:42 -08:00
Brian Tiger Chow
884143bf9c move generic packages to thirdparty (see thirdparty/README.md) 2015-01-18 14:04:45 -08:00
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
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
Brian Tiger Chow
12116dd6e4 style(fsrepo): rename to counter.Openers 2015-01-14 09:18:57 -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