Skip to content

Commit 3523639

Browse files
committed
Block read cache
ref: kahing#758
1 parent 3d906dd commit 3523639

19 files changed

+1112
-345
lines changed

.clang-format

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlinesLeft: true
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Inline
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: true
20+
AlwaysBreakTemplateDeclarations: true
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterClass: false
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: false
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
BeforeCatch: false
33+
BeforeElse: false
34+
IndentBraces: false
35+
BreakBeforeBinaryOperators: None
36+
BreakBeforeBraces: Attach
37+
BreakBeforeTernaryOperators: true
38+
BreakConstructorInitializersBeforeComma: false
39+
BreakAfterJavaFieldAnnotations: false
40+
BreakStringLiterals: true
41+
ColumnLimit: 80
42+
CommentPragmas: '^ IWYU pragma:'
43+
CompactNamespaces: false
44+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
45+
ConstructorInitializerIndentWidth: 8
46+
ContinuationIndentWidth: 8
47+
Cpp11BracedListStyle: true
48+
DerivePointerAlignment: false
49+
DisableFormat: false
50+
ExperimentalAutoDetectBinPacking: false
51+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
52+
IncludeCategories:
53+
- Regex: '^<.*\.h>'
54+
Priority: 1
55+
- Regex: '^<.*'
56+
Priority: 2
57+
- Regex: '.*'
58+
Priority: 3
59+
IncludeIsMainRegex: '([-_](test|unittest))?$'
60+
IndentCaseLabels: true
61+
IndentWidth: 4
62+
IndentWrappedFunctionNames: false
63+
JavaScriptQuotes: Leave
64+
JavaScriptWrapImports: true
65+
KeepEmptyLinesAtTheStartOfBlocks: false
66+
MacroBlockBegin: ''
67+
MacroBlockEnd: ''
68+
MaxEmptyLinesToKeep: 1
69+
NamespaceIndentation: None
70+
ObjCBlockIndentWidth: 2
71+
ObjCSpaceAfterProperty: false
72+
ObjCSpaceBeforeProtocolList: false
73+
PenaltyBreakBeforeFirstCallParameter: 1
74+
PenaltyBreakComment: 300
75+
PenaltyBreakFirstLessLess: 120
76+
PenaltyBreakString: 1000
77+
PenaltyExcessCharacter: 1000000
78+
PenaltyReturnTypeOnItsOwnLine: 200
79+
PointerAlignment: Left
80+
ReflowComments: true
81+
SortIncludes: true
82+
SpaceAfterCStyleCast: false
83+
SpaceBeforeAssignmentOperators: true
84+
SpaceBeforeParens: ControlStatements
85+
SpaceInEmptyParentheses: false
86+
SpacesBeforeTrailingComments: 2
87+
SpacesInAngles: false
88+
SpacesInContainerLiterals: true
89+
SpacesInCStyleCastParentheses: false
90+
SpacesInParentheses: false
91+
SpacesInSquareBrackets: false
92+
Standard: Auto
93+
TabWidth: 8
94+
UseTab: Never
95+
...

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ goofys
33
goofys.test
44
xout
55
s3proxy.jar
6+
/s3proxy.sh
7+
/mnt

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ check: staticcheck check-fmt check-gomod
4040

4141
.PHONY: staticcheck
4242
staticcheck:
43-
@staticcheck -checks 'all,-ST1000,-U1000,-ST1020,-ST1001' ./...
43+
@staticcheck -checks 'all,-ST1000,-U1000,-ST1020,-ST1001,-SA1019' ./...
4444

4545
.PHONY: unparam
4646
unparam:

api/api.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ func Mount(
4040
fuseLog.Level = logrus.DebugLevel
4141
log.Level = logrus.DebugLevel
4242
mountCfg.DebugLogger = GetStdLogger(fuseLog, logrus.DebugLevel)
43+
} else {
44+
GetLogger("fuse").Level = logrus.InfoLevel
4345
}
4446

4547
if flags.Backend == nil {

api/common/config.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ type FlagStorage struct {
4747
Backend interface{}
4848

4949
// Tuning
50-
Cheap bool
51-
ExplicitDir bool
52-
StatCacheTTL time.Duration
53-
TypeCacheTTL time.Duration
54-
HTTPTimeout time.Duration
50+
Cheap bool
51+
ExplicitDir bool
52+
BlockReadCache bool
53+
BlockReadCacheSize uint64
54+
BlockReadCacheMemRatio float64
55+
StatCacheTTL time.Duration
56+
TypeCacheTTL time.Duration
57+
HTTPTimeout time.Duration
5558

5659
// Debugging
5760
DebugFuse bool

go.mod

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ go 1.21
55
require (
66
cloud.google.com/go/storage v1.30.1
77
github.com/Azure/azure-pipeline-go v0.2.3
8-
github.com/Azure/azure-sdk-for-go v61.4.0+incompatible
9-
github.com/Azure/azure-storage-blob-go v0.14.0
10-
github.com/Azure/go-autorest/autorest v0.11.18
11-
github.com/Azure/go-autorest/autorest/adal v0.9.13
12-
github.com/Azure/go-autorest/autorest/azure/auth v0.5.7
13-
github.com/Azure/go-autorest/autorest/azure/cli v0.4.2
14-
github.com/aws/aws-sdk-go v1.44.37
8+
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible
9+
github.com/Azure/azure-storage-blob-go v0.15.0
10+
github.com/Azure/go-autorest/autorest v0.11.29
11+
github.com/Azure/go-autorest/autorest/adal v0.9.23
12+
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12
13+
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6
14+
github.com/aws/aws-sdk-go v1.44.278
1515
github.com/gofrs/uuid v4.2.0+incompatible
1616
github.com/google/uuid v1.3.0
1717
github.com/jacobsa/fuse v0.0.0-20240909130001-a1c7c8268f12
1818
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
1919
github.com/mitchellh/go-homedir v1.1.0
20+
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
2021
github.com/sevlyar/go-daemon v0.1.5
2122
github.com/shirou/gopsutil/v3 v3.24.5
2223
github.com/sirupsen/logrus v1.4.3-0.20190807103436-de736cf91b92
@@ -26,7 +27,7 @@ require (
2627
golang.org/x/sys v0.20.0
2728
google.golang.org/api v0.126.0
2829
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
29-
gopkg.in/ini.v1 v1.51.0
30+
gopkg.in/ini.v1 v1.67.0
3031
)
3132

3233
require (
@@ -41,25 +42,21 @@ require (
4142
github.com/Azure/go-autorest/logger v0.2.1 // indirect
4243
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
4344
github.com/dimchansky/utfbom v1.1.1 // indirect
44-
github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect
4545
github.com/go-ole/go-ole v1.2.6 // indirect
4646
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4747
github.com/golang/protobuf v1.5.3 // indirect
4848
github.com/google/go-cmp v0.6.0 // indirect
4949
github.com/google/s2a-go v0.1.4 // indirect
5050
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
5151
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
52-
github.com/gopherjs/gopherjs v0.0.0-20210413103415-7d3cbed7d026 // indirect
52+
github.com/hashicorp/golang-lru/v2 v2.0.7
5353
github.com/jmespath/go-jmespath v0.4.0 // indirect
54-
github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect
5554
github.com/kr/pretty v0.2.1 // indirect
5655
github.com/kr/text v0.1.0 // indirect
5756
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
5857
github.com/mattn/go-ieproxy v0.0.1 // indirect
5958
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
6059
github.com/shoenig/go-m1cpu v0.1.6 // indirect
61-
github.com/smartystreets/assertions v1.2.0 // indirect
62-
github.com/smartystreets/goconvey v1.6.4 // indirect
6360
github.com/tklauser/go-sysconf v0.3.12 // indirect
6461
github.com/tklauser/numcpus v0.6.1 // indirect
6562
github.com/yusufpapurcu/wmi v1.2.4 // indirect
@@ -74,5 +71,10 @@ require (
7471
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
7572
google.golang.org/grpc v1.58.3 // indirect
7673
google.golang.org/protobuf v1.33.0 // indirect
74+
)
75+
76+
require (
77+
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
78+
github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect
7779
gopkg.in/yaml.v2 v2.4.0 // indirect
7880
)

0 commit comments

Comments
 (0)