MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / OpenWriter

Method OpenWriter

internal/caches/storage_memory.go:170–180  ·  view source on GitHub ↗

OpenWriter 打开缓存写入器等待写入

(key string, expiredAt int64, status int, headerSize int, bodySize int64, maxSize int64, isPartial bool)

Source from the content-addressed store, hash-verified

168
169// OpenWriter 打开缓存写入器等待写入
170func (this *MemoryStorage) OpenWriter(key string, expiredAt int64, status int, headerSize int, bodySize int64, maxSize int64, isPartial bool) (Writer, error) {
171 if maxSize > 0 && this.ignoreKeys.Has(types.String(maxSize)+"$"+key) {
172 return nil, ErrEntityTooLarge
173 }
174
175 // TODO 内存缓存暂时不支持分块内容存储
176 if isPartial {
177 return nil, fmt.Errorf("%w (004)", ErrFileIsWriting)
178 }
179 return this.openWriter(key, expiredAt, status, headerSize, bodySize, maxSize, true)
180}
181
182// OpenFlushWriter 打开从其他媒介直接刷入的写入器
183func (this *MemoryStorage) OpenFlushWriter(key string, expiresAt int64, status int, headerSize int, bodySize int64) (Writer, error) {

Callers 1

TestMemoryStorage_PurgeFunction · 0.95

Calls 4

openWriterMethod · 0.95
ErrorfMethod · 0.80
HasMethod · 0.45
StringMethod · 0.45

Tested by 1

TestMemoryStorage_PurgeFunction · 0.76