2
0
mirror of synced 2025-02-24 06:38:14 +00:00

38 Commits

Author SHA1 Message Date
Matt Joiner
c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
Matt Joiner
e417c19a74 Add "no name" handling and storage.NewFileOpts
This came out of testing against Transmission in https://github.com/anacrolix/torrent/discussions/556#discussioncomment-1263670.
2021-09-02 10:22:32 +10:00
Matt Joiner
c3c982b621 Fixes for wasm 2021-06-23 17:24:50 +10:00
Matt Joiner
5f8471e21b Rework storage.TorrentImpl to support shared capacity key 2021-06-07 13:01:39 +10:00
gitpubber
b8e1c95399
Allows one to use Custom PieceCompletion (#486)
* Change ClientImpl to ClientImplCloser

We cannot close underlying Boltdb PieceCompletion if it is not closable

* Update file.go
2021-05-09 19:34:41 +10:00
gitpubber
5e53f35b72 Change ClientImpl to ClientImplCloser
We cannot close underlying Boltdb PieceCompletion if it is not closable
2021-05-09 11:04:43 +10:00
Matt Joiner
8088002ba6 Fix error handling for bad torrent adds with safe file handling 2020-10-15 16:03:43 +11:00
Matt Joiner
89235e180f Sanitize metainfo file paths for file-based storage
Fixes exploit where specially crafted infos can cause the client to write files to arbitrary locations on local storage when using file-based storages like mmap and file.
2020-10-15 15:45:08 +11:00
Matt Joiner
235c67a6ec Remove debug logging from storage file implementation 2020-06-01 11:12:51 +10:00
Matt Joiner
604af2be82 storage file implementation: Error on short writes 2020-06-01 11:12:33 +10:00
Matt Joiner
69a0f2f1e4 Got file storage working with segment index 2020-06-01 00:14:51 +10:00
Matt Joiner
19ce53e69f Make io.EOF an expected error from storage.Piece.ReadAt
Fixes #381.
2020-02-27 16:45:57 +11:00
Matt Joiner
c855c7a366 Differentiate between storage.ClientImpl{,Closer} 2020-02-21 14:12:44 +11:00
Matt Joiner
cb1bf0f413 goimports -local 2019-08-21 20:58:40 +10:00
Matt Joiner
fc4fab91f5 Switch to goimports import sorting
Used to use sortimports, but it's old, and goimports seems to have an opinion now.
2018-11-02 23:12:01 +11:00
Matt Joiner
bd5ae2cb6d Fix doc comment 2018-07-15 12:56:28 +10:00
Ian Bishop
ffd41230a6 Fix file permissions 2018-06-09 15:11:28 +02:00
Matt Joiner
dd083a4e11 Track completion known to implementation state
Addresses #193
2017-10-12 16:09:32 +11:00
Matt Joiner
018afed5a7 storage: Remove incorrect comment 2017-09-23 15:27:26 +10:00
Matt Joiner
cee24fe21b storage: Add TODO about handling Close errors 2017-09-12 18:31:56 +10:00
mlmhl
d8c7f37d2b make pieceCompletion configurable 2017-05-22 10:23:37 +08: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
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
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
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
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
dbb3c25b1a storage: Move pieceCompletion interface into correct file 2016-07-06 13:38:16 +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
02ea8b1081 Rename storage.I->Client 2016-05-16 21:50:43 +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
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