2
0
mirror of synced 2025-02-24 14:48:27 +00:00

49 Commits

Author SHA1 Message Date
Matt Joiner
49648b9ae1 Close implicit Client default storage on Client.Close
Fixes #158
2017-06-01 22:57:08 +10:00
Matt Joiner
c2f77fc84a Make bolt completion DB directory if necessary 2017-06-01 11:20:50 +10:00
mlmhl
d8c7f37d2b make pieceCompletion configurable 2017-05-22 10:23:37 +08:00
Matt Joiner
65a7c3daa7 storage: Fix race condition in mapPieceCompletion 2017-03-30 21:38:44 +11:00
Matt Joiner
9bd463ffc0 storage: Add package doc 2017-03-18 13:03:02 +11:00
Chris Walker
9d96cd659f fix Spec.Storage and allow per-torrent dir
`TorrentSpec.Storage` was not honored when calling `Client.AddTorrentSpec`
and the configured `cfg.DefaultStorage` was always used. Now if you construct
your `TorrentSpec` you can specify any `StorageImpl`

Also, the most common use case for custom storage being per-torrent paths for
FileStorage, this adds a `pathMaker` function to the File implementation that
allows customization, along with the default (always use base path) and my use
case (which seemed common enough from the Gitter chat) which is infohash based
subdirectories.

All Public methods have not changed signature, but 1 private method did, hence
the test update.
2017-03-16 14:40:21 +00:00
Matt Joiner
1c37903a74 Remove FileStorePieces storage backend
ResourcePIeces is now preferred.
2017-01-05 17:00:59 +11:00
Matt Joiner
5e83287890 storage: ClientImpl interface now includes Close
This is now necessary because bolt doesn't allow multiple DB handles, so the bolt piece completion DB instance must be at the client level. The new method is not currently used from the Client however, this maybe necessary to avoid leaks.
2016-10-25 20:00:09 +11:00
Matt Joiner
3814a50fa0 storage: Fix spelling mistake 2016-10-25 19:57:35 +11:00
Matt Joiner
27893acf34 storage: Only include sqlite3 piece completion implementation if cgo is enabled
Issue #124.
2016-10-25 19:54:09 +11:00
Matt Joiner
18309b866b storage: Remove sqlite3 import from bolt implementation
#124
2016-10-25 19:52:44 +11:00
Matt Joiner
5c5a26afed Add bolt piece completion DB
This means it can be persistent without needing cgo. Fixes issues #115 and #124.
2016-10-25 19:07:26 +11:00
Matt Joiner
69ffbe6a48 storage: Move sqlite3 import to appropriate file 2016-09-16 11:19:26 +10:00
Matt Joiner
d4e30f84f2 Rename some of the unexported file storage types 2016-09-12 17:26:39 +10:00
Matt Joiner
b5ed171ac5 Create zero-length files in the file storage when the torrent storage is opened
Fixes #111.
2016-09-12 17:01:00 +10:00
Matt Joiner
1e919dd6b1 Rework storage interfaces to make them simpler to implement
This allows lots of behaviour to be baked into the new Client, Torrent and Piece wrappers, rather than duplicating (badly) them in all the backend implementations.
2016-09-02 15:10:57 +10:00
Matt Joiner
db3be3441f storage.boltDB: Some comments, and use global completedValue 2016-08-31 21:00:44 +10:00
Matt Joiner
c121615fab Extract chunkSize as a const 2016-08-31 20:11:04 +10:00
Matt Joiner
e51cb07f6e Uncomment the error handling in storage.boltDBPiece.ReadAt 2016-08-31 18:02:45 +10:00
Matt Joiner
3c2db92a83 Add boltdb storage backend 2016-08-31 17:48:50 +10:00
Matt Joiner
2a1cef7c9e Remove the InfoEx type, and don't generate its infohash on the fly
Fixes #106.
2016-08-26 20:29:05 +10:00
Matt Joiner
a1ba463750 Fix issue #97 2016-07-12 16:45:22 +10:00
Matt Joiner
f055abe2fc Fix issue #96
In the native file-based storage, mark pieces incomplete if the necessary file data is missing, or there's a read error on a piece.
2016-07-10 23:03:59 +10:00
Matt Joiner
9c837a03d0 Move issue #95 tests into their own file 2016-07-09 00:36:53 +10:00
Matt Joiner
11a53fa732 Fix issue #95: Closing torrent storage also closed client storage for some storage types 2016-07-09 00:36:32 +10:00
Matt Joiner
408686b440 Add a test for issue #95 2016-07-09 00:28:12 +10:00
Matt Joiner
cd1c1a9fed mmap storage: Close pieceCompletion on Close 2016-07-06 14:02:15 +10:00
Matt Joiner
dbb3c25b1a storage: Move pieceCompletion interface into correct file 2016-07-06 13:38:16 +10:00
Matt Joiner
ce0a3d56f1 storage: Remove debug log 2016-06-20 18:21:16 +10:00
Matt Joiner
d80d0db9d5 storage: Also use completion DB in mmap implementation 2016-06-20 18:20:59 +10:00
Matt Joiner
cee200a5a2 Add piece completion storage
Toward fixing https://github.com/anacrolix/torrent/issues/50.
2016-06-20 17:51:05 +10:00
Matt Joiner
b75e85d187 storage.MMapTorrent should not be exported 2016-06-20 16:11:43 +10:00
Matt Joiner
869fb25cbc Changes to missinggo resource package 2016-05-16 22:32:00 +10:00
Matt Joiner
c1e0d37266 Rename some storage funcs 2016-05-16 22:02:03 +10:00
Matt Joiner
02ea8b1081 Rename storage.I->Client 2016-05-16 21:50:43 +10:00
Matt Joiner
61e43f4261 Add piece-per-resource storage 2016-05-16 18:44:58 +10:00
Matt Joiner
0aabd37e6e Add some comments to file storage 2016-05-09 15:46:48 +10:00
Seth Hoenig
9f4bf70e17 refactor struct identifiers to follow conventional go names 2016-04-18 23:11:11 -05:00
Matt Joiner
86e34977de piece-file storage: Use the receiver-local FileStore field
Because aliens, mainly.
2016-04-14 17:28:30 +10:00
Matt Joiner
b80bb6393a Use metainfo.Hash for piece and info hashes 2016-04-04 13:01:31 +10:00
Matt Joiner
e3a7433154 piece file storage: Don't write to completed pieces 2016-04-03 16:37:50 +10:00
Matt Joiner
f19e8b32aa storage: Don't read bad completed piece files 2016-04-03 16:33:31 +10:00
Matt Joiner
7638d678a8 storage: Fix io.EOF on short piece files 2016-04-02 16:57:22 +11:00
Matt Joiner
7790e72832 Move storage.FileStore interface to missinggo 2016-03-30 19:12:33 +11:00
Matt Joiner
baa8c1aed2 Few fixes for downstream projects 2016-03-29 12:13:03 +11:00
Matt Joiner
ee22446440 Reimplement piece storage 2016-03-29 11:14:34 +11:00
Matt Joiner
a5b54f21a1 Make opening a torrent in storage an explicit method
This is storage types where opening can fail, like mmap
2016-03-28 22:40:29 +11:00
Matt Joiner
775cf53809 Get mmap storage working 2016-03-28 21:57:04 +11:00
Matt Joiner
b97b50aca9 New storage interface 2016-03-28 20:38:30 +11:00