Documentation
¶
Overview ¶
Package remotefile defines the protocol-independent remote file read boundary.
Index ¶
- func ReadRange(ctx context.Context, source Source, path string, offset, length int64) ([]byte, error)
- type HTTPSource
- type Info
- func Fetch(ctx context.Context, cache *diskcache.Cache, source Source, path string) ([]byte, Info, error)
- func ReadCachedRange(ctx context.Context, cache *diskcache.Cache, source Source, path string, ...) ([]byte, Info, error)
- func ReadHotCachedRange(ctx context.Context, hot *rangecache.Cache, cache *diskcache.Cache, ...) ([]byte, Info, error)
- type LocalSource
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HTTPSource ¶
HTTPSource adapts another Eta instance's existing read-only API to Source. Peer discovery/configuration remains separate from this transport boundary.
func (*HTTPSource) OpenRange ¶
func (s *HTTPSource) OpenRange(ctx context.Context, path string, offset, length int64) (io.ReadCloser, error)
type Info ¶
func Fetch ¶
func Fetch(ctx context.Context, cache *diskcache.Cache, source Source, path string) ([]byte, Info, error)
Fetch reads a versioned remote file through a cache. It deliberately has no peer protocol dependency: transports implement Source and tests use fakes.
func ReadCachedRange ¶
func ReadCachedRange(ctx context.Context, cache *diskcache.Cache, source Source, path string, offset, length int64) ([]byte, Info, error)
ReadCachedRange reads a bounded byte range and stores it under the file's version. A changed size/mtime produces a new key, so stale blocks are never served after a peer updates a file.
type LocalSource ¶
type LocalSource struct {
// contains filtered or unexported fields
}
LocalSource is the baseline Source implementation used by a serving Eta host. It provides the same containment boundary a future peer transport must honor.
func NewLocalSource ¶
func NewLocalSource(root string) (*LocalSource, error)
func (*LocalSource) OpenRange ¶
func (s *LocalSource) OpenRange(ctx context.Context, path string, offset, length int64) (io.ReadCloser, error)