2
0
mirror of synced 2025-02-23 22:28:11 +00:00

193 Commits

Author SHA1 Message Date
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
23029571ec Fix panic on double Close of sqlite piece completion DB 2021-09-02 10:22:32 +10:00
Matt Joiner
8a65ef627d Set direct sqlite storage conn to nil on close
This might help catch the reason for SQLITE_MISUSE in getCapacity.
2021-08-19 13:37:00 +10:00
Bora M. Alper
16176b762e
Add linter CI (#542)
* Add linter CI

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Make gosec CI ignore SHA1 and upload sarif

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Fix formatting of source files

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Make go vet ignore unkeyed composite literals and fix other warnings

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Make staticcheck ignore unused methods and fix other warnings

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Use golangci-lint

Signed-off-by: Bora M. Alper <bora@boramalper.org>
2021-08-16 11:11:31 +10:00
Matt Joiner
87294355fb Fix race in sqlite direct storage init
There's a race between starting the blob flusher and assigning the timer to the storage client.
2021-08-11 09:44:09 +10:00
Matt Joiner
1d53c170b0 Close torrent storage asynchronously on drop 2021-07-17 19:10:07 +10:00
Matt Joiner
3b62b0054d Fix go:build directives 2021-07-14 14:35:52 +10:00
Matt Joiner
c3c982b621 Fixes for wasm 2021-06-23 17:24:50 +10:00
Matt Joiner
5fc42e8105 Remove sqlite piece-resource storage 2021-06-21 12:29:37 +10:00
Matt Joiner
ebd19af795 Merge branch 'request-strategy-rewrite' 2021-06-21 12:04:06 +10:00
Zilog8
e2a559e243
Allow Storage Backends to do their own Hashing (#518)
* Allow Storage Backends to do their own Hashing

- Describes an optional interface 'SelfHashing' that a storage backend's type implementing 'PieceImpl' may also implement in order to calculate piece hashsums itself.

- Alters the 'hashPiece' function in the torrent package to look for types implementing 'SelfHashing' . If not implemented, calculate the hash as usual.
2021-06-08 15:45:35 +10:00
deepsource-autofix[bot]
a68f040ea6 Fix nil context being passed to function 2021-06-07 19:32:02 +10:00
Matt Joiner
f183acefe2 Add default param name in TorrentImpl.Piece func 2021-06-07 13:01:40 +10:00
Matt Joiner
ef39f408fe Add storage/disabled
The default storage will create empty files on torrent open, which is undesirable in some circumstances. This storage implementation is explicit about not storing anything.
2021-06-07 13:01:40 +10:00
Matt Joiner
5f8471e21b Rework storage.TorrentImpl to support shared capacity key 2021-06-07 13:01:39 +10:00
gitpubber
8f6f47a2e0
Added build tags to disable few packages if necessary (#499) 2021-05-25 18:48:59 +10:00
Matt Joiner
a60a4c9117 Progress testing without cgo a bit 2021-05-21 15:22:26 +10:00
Matt Joiner
b21aebeaae Make wal the default for sqlite resource pieces
Fixes broken test as a result.
2021-05-17 11:56:10 +10:00
Matt Joiner
7798e2a306 Make synchronous=off the default 2021-05-17 11:56:10 +10:00
Matt Joiner
c585b84126 Set smarter defaults 2021-05-17 11:56:10 +10:00
Matt Joiner
fc0f2d146d Set page size before initializing connections
Setting page_size seems to be ignored if done after setting journal_mode, specifically to WAL I think. There's huge performance benefits to getting it right.
2021-05-17 11:56:10 +10:00
Matt Joiner
ad421ea2d0 Default to sqlite piece completion for dir if cgo enabled 2021-05-14 15:51:26 +10:00
Matt Joiner
a4e84688ae Fix sqlite piece completion 2021-05-14 15:45:54 +10:00
Matt Joiner
961cbfd765 Add CustomDirect BenchmarkMarkComplete sub-test 2021-05-14 15:42:54 +10:00
Matt Joiner
7b3e48b915 Expose SetSynchronous as an option 2021-05-14 15:41:56 +10:00
Matt Joiner
5030804b01 Fix race in MarkNotComplete 2021-05-14 15:41:28 +10:00
Matt Joiner
e5d21dbf34 Don't create blobs when reading 2021-05-14 15:41:23 +10:00
Matt Joiner
b151514154 Tidy up sqlite direct piece receiver name 2021-05-14 15:40:59 +10:00
Matt Joiner
9feb85d0d1 Remove unused method 2021-05-14 15:40:38 +10:00
Matt Joiner
627b75c8b4 Merge branch 'sqlite-direct' 2021-05-14 15:36:35 +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
8dcc52ccf9 Don't set the page size by default 2021-05-06 15:25:01 +10:00
Matt Joiner
96574468c5 Expose a variety of blob cleanup styles 2021-05-06 15:17:31 +10:00
Matt Joiner
abe003b6b3 Benchmark different mmap sizes and journal modes 2021-05-06 12:00:20 +10:00
Matt Joiner
20c00dedc0 Rework lots of option handling 2021-05-05 21:36:36 +10:00
Matt Joiner
acfe0ba87e Rename new.go 2021-05-05 15:55:08 +10:00
Matt Joiner
b583fe3d47 Use bench timer more effectively, and use Piece.WriteTo 2021-05-05 15:53:43 +10:00
Matt Joiner
c3768da38c Use sync.Map in map piece completion 2021-05-05 12:38:26 +10:00
Matt Joiner
cf8bd49abe Big rename of files and types in storage 2021-05-05 12:05:02 +10:00
Matt Joiner
745a34b43e Handle expired blobs as they occur 2021-05-05 11:47:39 +10:00
Matt Joiner
675a0ab0dc Rework to use a pool of blobs 2021-05-05 10:02:15 +10:00
Matt Joiner
855144212c Get benchmarks working 2021-05-04 22:56:43 +10:00
Matt Joiner
afea28091f Implement sqlite directly without using piece resources 2021-05-04 19:51:42 +10:00
Matt Joiner
256101768e piece resource storage: Do sized puts for WriteAts if possible 2021-05-04 12:44:51 +10:00
Matt Joiner
0021c2a70c Use BenchmarkMarkComplete for non-sqlite storages too 2021-05-04 12:44:51 +10:00
Matt Joiner
f00f513706 Add missing closeMu use in ReadConsecutiveChunks 2021-02-22 16:39:21 +11:00
Matt Joiner
ac05b69e11 Only write update bolt piece completion if the existing value differs 2021-02-22 14:51:34 +11:00
Matt Joiner
86a2b71c47 Code comment 2021-02-19 12:37:26 +11:00
Matt Joiner
579925fa94 Fix panic in benchmark 2021-02-05 10:01:33 +11:00