2019-02-20 14:24:25 +00:00
|
|
|
package state
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-06-15 09:19:17 +00:00
|
|
|
"github.com/ipfs-cluster/ipfs-cluster/api"
|
2019-02-20 14:24:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type empty struct{}
|
|
|
|
|
2022-03-22 09:56:16 +00:00
|
|
|
func (e *empty) List(ctx context.Context, out chan<- api.Pin) error {
|
|
|
|
close(out)
|
|
|
|
return nil
|
2019-02-20 14:24:25 +00:00
|
|
|
}
|
|
|
|
|
2022-04-07 11:53:30 +00:00
|
|
|
func (e *empty) Has(ctx context.Context, c api.Cid) (bool, error) {
|
2019-02-20 14:24:25 +00:00
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
|
2022-04-07 11:53:30 +00:00
|
|
|
func (e *empty) Get(ctx context.Context, c api.Cid) (api.Pin, error) {
|
2022-03-19 01:52:46 +00:00
|
|
|
return api.Pin{}, ErrNotFound
|
2019-02-20 14:24:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Empty returns an empty read-only state.
|
|
|
|
func Empty() ReadOnly {
|
|
|
|
return &empty{}
|
|
|
|
}
|