Documentation
¶
Index ¶
- type Cache
- func (c *Cache) AddPacket(p *packet.Packet, repo *database.Repository)
- func (c *Cache) GetDBFile(repo *database.Repository) (ReadSeekCloser, time.Time, error)
- func (c *Cache) GetPacket(p *packet.Packet, repo *database.Repository) (ReadSeekCloser, error)
- func (c *Cache) ProxyRepo(w http.ResponseWriter, r *http.Request, repo *database.Repository)
- func (c *Cache) UpdateDatabases(result chan<- error)
- type ReadSeekCloser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a cache that caches packages in the filesystem. The currently only implementation at the moment is storing it in a directory in the filesystem.
func New ¶
func New(directory string, mirrors mirrorlist.Mirrorlist) (*Cache, error)
New creates a new cache from a given directory
func (*Cache) AddPacket ¶
func (c *Cache) AddPacket(p *packet.Packet, repo *database.Repository)
AddPacket downloads the given packet in the background when possible and adds it to the cache afterwards
func (*Cache) GetDBFile ¶
func (c *Cache) GetDBFile(repo *database.Repository) (ReadSeekCloser, time.Time, error)
GetDBFile returns the latest cached version of a given database together with the time it was updated.
func (*Cache) GetPacket ¶
func (c *Cache) GetPacket(p *packet.Packet, repo *database.Repository) (ReadSeekCloser, error)
GetPacket serves a packet either from the cache or proxies it from a mirror Returns an io.ReadSeaker with access to the packet data
func (*Cache) ProxyRepo ¶
func (c *Cache) ProxyRepo(w http.ResponseWriter, r *http.Request, repo *database.Repository)
ProxyRepo will proxy the given repository database file from a mirror with out downloading it to the cache.
func (*Cache) UpdateDatabases ¶
UpdateDatabases will update all cached database files in the background The error (may be nil) WILL be sent to the channel EXACTLY ONCE
For each updated database, updating their accoring cached packages will be started in the background.
type ReadSeekCloser ¶
type ReadSeekCloser interface {
io.ReadSeeker
io.Closer
}
ReadSeekCloser implements io.ReadSeeker and io.Closer