storagecache

package
v0.0.0-...-ff42f87 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheItemReader

type CacheItemReader struct {
	// contains filtered or unexported fields
}

func (*CacheItemReader) Close

func (r *CacheItemReader) Close() error

func (*CacheItemReader) Filename

func (r *CacheItemReader) Filename() string

func (*CacheItemReader) Read

func (r *CacheItemReader) Read(p []byte) (n int, err error)

func (*CacheItemReader) Seek

func (r *CacheItemReader) Seek(offset int64, whence int) (int64, error)

type StorageCache

type StorageCache struct {
	// contains filtered or unexported fields
}

StorageCache caches blob store files on the local disk so that clients can seek inside them. It would be possible to build this functionality without a cache, but then I couldn't just use http.ServeContent, and would instead need to implement all of the range request headers, etc. See this issue for a discussion and example code that gets around this: https://github.com/googleapis/google-cloud-go/issues/1124 The above solution is not ideal, because every Read() needs to re-open the blob. As far as I know, http.ServeContent is going to read in chunks of like 4k, so that would be terribly inefficient for 16MB file.

func NewStorageCache

func NewStorageCache(log logs.Log, upstream storage.Storage, cacheRoot string, maxBytes int64) (*StorageCache, error)

func (*StorageCache) Open

func (s *StorageCache) Open(filename string) (*CacheItemReader, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL