Commit 3eb93ce3 authored by Dustin L. Howett's avatar Dustin L. Howett

Rename the StorageAdapter interface functions so they're less generic.

parent af12bc6a
......@@ -122,7 +122,7 @@ func NewExpiratorWithStorage(sa StorageAdapter, store ExpirableStore) *Expirator
}
func (e *Expirator) loadExpirations() error {
hm, err := e.adapter.Load()
hm, err := e.adapter.LoadExpirationHandles()
if err != nil {
return err
}
......@@ -142,7 +142,7 @@ func (e *Expirator) saveExpirations() error {
if e.expirationMap == nil {
return nil
}
err := e.adapter.Save(e.expirationMap)
err := e.adapter.SaveExpirationHandles(e.expirationMap)
if err != nil {
return err
}
......
......@@ -10,8 +10,8 @@ type legacyUpgradingGobFileAdapter struct {
*GobFileAdapter
}
func (a *legacyUpgradingGobFileAdapter) Load() (*HandleMap, error) {
hm, err := a.GobFileAdapter.Load()
func (a *legacyUpgradingGobFileAdapter) LoadExpirationHandles() (*HandleMap, error) {
hm, err := a.GobFileAdapter.LoadExpirationHandles()
if err == nil {
return hm, err
}
......
......@@ -7,14 +7,14 @@ import (
// StorageAdapter is the interface through which expiration storage is abstracted.
//
// Save stores a set of expiration handles, and Load returns them unharmed.
// SaveExpirationHandles stores a set of expiration handles, and LoadExpirationHandles returns them unharmed.
//
// Implementation that care about saving their changes in a timely manner should
// return true from RequiresFlush.
type StorageAdapter interface {
RequiresFlush() bool
Save(*HandleMap) error
Load() (*HandleMap, error)
SaveExpirationHandles(*HandleMap) error
LoadExpirationHandles() (*HandleMap, error)
}
// GobFileAdapter is a StorageAdapter that saves expiration handles in a file via the encoding/gob package.
......@@ -26,7 +26,7 @@ func (a *GobFileAdapter) RequiresFlush() bool {
return true
}
func (a *GobFileAdapter) Save(hm *HandleMap) error {
func (a *GobFileAdapter) SaveExpirationHandles(hm *HandleMap) error {
file, err := os.Create(a.filename)
if err != nil {
return err
......@@ -40,7 +40,7 @@ func (a *GobFileAdapter) Save(hm *HandleMap) error {
return nil
}
func (a *GobFileAdapter) Load() (*HandleMap, error) {
func (a *GobFileAdapter) LoadExpirationHandles() (*HandleMap, error) {
file, err := os.Open(a.filename)
if err != nil {
return nil, err
......@@ -66,9 +66,9 @@ func (NoopAdapter) RequiresFlush() bool {
return false
}
func (NoopAdapter) Save(*HandleMap) error {
func (NoopAdapter) SaveExpirationHandles(*HandleMap) error {
return nil
}
func (NoopAdapter) Load() (*HandleMap, error) {
func (NoopAdapter) LoadExpirationHandles() (*HandleMap, error) {
return nil, nil
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment