mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-30 01:37:04 +08:00
优化缓存管理
This commit is contained in:
29
internal/caches/reader.go
Normal file
29
internal/caches/reader.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package caches
|
||||
|
||||
type ReaderFunc func(n int) (goNext bool, err error)
|
||||
|
||||
type Reader interface {
|
||||
// 初始化
|
||||
Init() error
|
||||
|
||||
// 状态码
|
||||
Status() int
|
||||
|
||||
// 读取Header
|
||||
ReadHeader(buf []byte, callback ReaderFunc) error
|
||||
|
||||
// 读取Body
|
||||
ReadBody(buf []byte, callback ReaderFunc) error
|
||||
|
||||
// 读取某个范围内的Body
|
||||
ReadBodyRange(buf []byte, start int64, end int64, callback ReaderFunc) error
|
||||
|
||||
// Header Size
|
||||
HeaderSize() int64
|
||||
|
||||
// Body Size
|
||||
BodySize() int64
|
||||
|
||||
// 关闭
|
||||
Close() error
|
||||
}
|
||||
Reference in New Issue
Block a user