Commit Graph

236 Commits

Author SHA1 Message Date
whr819987540 d0a23d3369 modify log info 2023-05-18 18:25:22 +08:00
whr819987540 c642515007 use mbpp to modify mbp 2023-05-08 16:38:45 +08:00
whr819987540 9f812744d0 NewMemory double pointer 2023-05-08 16:13:44 +08:00
whr819987540 f58ec9e188 NewMemory supports both seeder and leecher 2023-05-08 15:52:10 +08:00
whr819987540 bc82214838 support seeding 2023-05-06 15:04:12 +08:00
whr819987540 16ce9dc617 增加一个直接从Client返回ClientImpl的函数,用于读取MemoryClientImpl实际写入内存的字节数 2023-05-04 17:24:58 +08:00
whr819987540 ee2821f72e 实现MemoryClientImpl 2023-05-04 17:20:39 +08:00
whr819987540 2848a224f9 add debug info 2023-04-27 15:59:04 +08:00
whr819987540 31b19a2f19 add comment 2023-04-27 15:58:22 +08:00
Matt Joiner e8b04c7181
gofumpt 2023-02-18 18:35:22 +11:00
Colin Marc 60fd7581e7
Remove unecessary completion "set" (#812)
If the file has never been downloaded, complete will naturally be false. It's
not necessary to then set it false again unless it was actually claimed to be
true in the first place.

In my tests, using the boltdb completion thingy with fsync turned *on*, this
reduced the cold start for big buck bunny from multiple seconds to just a few
ms.
2023-02-13 14:26:03 +11:00
Matt Joiner 50a665f278
New go fmt on doc comments 2022-12-07 10:44:05 +11:00
Matt Joiner 3e0f34934d
gorond ./... 2022-11-15 23:31:27 +11:00
Alex Sharov 75cc4e98d4
Do torrent storage flush on piece completion (#755) 2022-07-07 15:46:27 +10:00
Matt Joiner aa4a831c78
Rearrange transfer tests so build directives are applied by the right packages 2022-03-17 16:08:00 +11:00
Matt Joiner 4fdbe734bb
Add dummy sqlite storage Go file 2022-03-15 17:52:24 +11:00
Matt Joiner fedc611f4b
Don't build storage/sqlite tests without cgo 2022-03-15 15:51:41 +11:00
Matt Joiner 7979d7ef96
Fix 386 cross compile and wasm build for crawshaw 2022-03-15 14:37:52 +11:00
Matt Joiner 47a15797a4 Exclusively use crawshaw instead of zombiezen for sqlite
Zombiezen doesn't support as many platforms as crawshaw for example.
2022-02-10 10:22:39 +11:00
Eng Zer Jun 841a702e34
test: use `T.TempDir` to create temporary test directory (#718)
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-02-02 18:26:46 +11:00
Matt Joiner 0c7754da63 Add const noCacheBlobs in sqlite storage benchmarks 2022-01-10 16:20:03 +11:00
Matt Joiner 7197c5f493 Fix wasm build
This was broken in the move to zombiezen sqlite, which still doesn't work on WASM/JS.
2021-12-07 13:08:06 +11:00
Matt Joiner 65ceef557a Remove CGO build flags for pure-Go squirrel branch 2021-11-19 20:29:30 +11:00
Matt Joiner 3ab251fcf5 Use zombiezen branch of squirrel 2021-11-19 20:10:07 +11:00
Matt Joiner 24f3ecc7cd Use zombiezen sqlite for piece completion 2021-11-19 16:18:41 +11:00
Matt Joiner c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
Matt Joiner b088c08acd Remove some unused parameter names
https://deepsource.io/gh/anacrolix/torrent/run/cfd6fa3d-c65b-4bf7-83f7-3bee87c21a4b/go/RVV-B0012
2021-11-01 11:53:58 +11:00
Matt Joiner 1788303405 Alter some directory permissioning in storage 2021-11-01 11:50:12 +11:00
afjoseph 013634d9f1 Revert "Remove old-style build tags"
This reverts commit 11ae25660a.
2021-11-01 11:26:58 +11:00
Matt Joiner 11ae25660a Remove old-style build tags 2021-10-07 09:12:17 +11:00
Matt Joiner 2b443d695b Change torrent capacity to not return a pointer
It's an unnecessary complication for a storage implementer.
2021-09-15 23:33:17 +10:00
YenForYang a8db640c62
Drop bradfitz/iter dependency (#605)
* Drop bradfitz/iter dependency

`range iter.N` looks nice and doesn't allocate, but unfortunately using a `range` expression blocks a function from being inlined wherever it's used (for now). It's not that we need inlining in all cases, but I do think a C-style for loop looks just as nice and is probably clearer to the majority. There also aren't any clear disadvantages to changing (unless you just happen to dislike the look of C)

* Update misc_test.go

* Update rlreader_test.go

* Update torrent_test.go

* Update bench_test.go

* Update client_test.go

* Update iplist_test.go

* Update mse_test.go

* Update peerconn_test.go

* Update peerconn.go

* Update order_test.go

* Update decoder_test.go

* Update main.go

* Update bench-piece-mark-complete.go

* Update main.go

* Update torrent.go

* Update iplist_test.go

* Update main.go
2021-09-14 13:46:50 +10:00
Matt Joiner 151bf9ea68 Fix unit tests littering working directory 2021-09-09 12:58:07 +10:00
Matt Joiner ad70dcdbf4 Return error on sqlite PieceCompletion.Set when closed 2021-09-04 23:07:32 +10:00
Matt Joiner d4c3a690ab Merge branch 'master' into squirrel 2021-09-02 14:19:29 +10:00
Matt Joiner b4a66a3ca7 Add generics TODO 2021-09-02 10:22:32 +10: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 23029571ec Fix panic on double Close of sqlite piece completion DB 2021-09-02 10:22:32 +10:00
Matt Joiner cf6c20d306 Add function to wrap squirrel.Cache as storage.ClientImpl 2021-08-26 11:20:37 +10:00
Matt Joiner 91873addfa Update squirrel 2021-08-26 11:19:39 +10:00
Matt Joiner d6fcf7a32a Use separate squirrel module 2021-08-25 14:37:00 +10:00
Matt Joiner 19d5905b6c Removed unused sqlite "provider" storage 2021-08-25 12:35:07 +10:00
Matt Joiner 8df24008ea Embed SQL 2021-08-24 22:24:39 +10:00
Matt Joiner 08d2dea5b4 Implement {Set,Get}Tag on SquirrelBlob 2021-08-24 18:37:38 +10:00
Matt Joiner f2f541a46b Begin extracting 'squirrel' from storage/sqlite 2021-08-24 17:52:31 +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