Skip to content

Commit

Permalink
rename object strore as cache for consistency
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Chacin <[email protected]>
  • Loading branch information
pablochacin committed Jun 17, 2024
1 parent 8830b49 commit a853fd7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ type Cache interface {
Store(ctx context.Context, id string, content io.Reader) (Object, error)
}

// an ObjectStore backed by a file
type fileObjectStore struct {
// a Cache backed by a file system
type fileCache struct {
path string
}

Expand All @@ -52,13 +52,13 @@ func NewFileCache(path string) (Cache, error) {
return nil, fmt.Errorf("%w: %w", ErrInitializingCache, err)
}

return &fileObjectStore{
return &fileCache{
path: path,
}, nil
}

// Store stores the object and returns the metadata
func (f *fileObjectStore) Store(_ context.Context, id string, content io.Reader) (Object, error) {
func (f *fileCache) Store(_ context.Context, id string, content io.Reader) (Object, error) {
objectDir := filepath.Join(f.path, id)
// TODO: check permissions
err := os.MkdirAll(objectDir, 0o750)
Expand Down Expand Up @@ -98,7 +98,7 @@ func (f *fileObjectStore) Store(_ context.Context, id string, content io.Reader)
}

// Get retrieves an objects if exists in the cache or an error otherwise
func (f *fileObjectStore) Get(_ context.Context, id string) (Object, error) {
func (f *fileCache) Get(_ context.Context, id string) (Object, error) {
objectDir := filepath.Join(f.path, id)
_, err := os.Stat(objectDir)

Expand Down

0 comments on commit a853fd7

Please sign in to comment.