Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Datastorer ¶
Datastorer reads and writes data to an object.
type GCPStorage ¶
type GCPStorage struct {
// contains filtered or unexported fields
}
GCPStorage represents a Google Cloud Storage object.
func NewGCPStorage ¶
func NewGCPStorage(bucket string, object string) *GCPStorage
NewGCPStorage returns a Google Cloud storage item given a bucket and an object path.
func (*GCPStorage) Load ¶
func (s *GCPStorage) Load() ([]byte, error)
Load downloads an object from a bucket and returns an error if it cannot be read.
func (*GCPStorage) Save ¶
func (s *GCPStorage) Save(b []byte) error
Save uploads an object to a bucket and returns an error if it cannot be written.
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage represents a file on the filesytem.
func NewLocalStorage ¶
func NewLocalStorage(path string) *LocalStorage
NewLocalStorage returns a local storage object given a file path.
func (*LocalStorage) Load ¶
func (s *LocalStorage) Load() ([]byte, error)
Load returns a file contents from the filesystem.
func (*LocalStorage) Save ¶
func (s *LocalStorage) Save(b []byte) error
Save writes a file to the filesystem and returns an error if one occurs.
type Storage ¶
type Storage struct { Site *stalecache.Cache[model.Site] // contains filtered or unexported fields }
Storage represents a writable and readable object.
func New ¶
func New(ds Datastorer) (*Storage, error)
New returns a writable and readable site object. Returns an error if the object cannot be initially read.
func (*Storage) InvalidateSite ¶
func (s *Storage) InvalidateSite()
InvalidateSite invalidates the site cache and force a reload on next load.