2018-07-16 21:44:28 +01:00
|
|
|
// Copyright (C) 2018 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package streams
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"storj.io/storj/pkg/paths"
|
|
|
|
"storj.io/storj/pkg/ranger"
|
|
|
|
)
|
|
|
|
|
2018-07-30 19:57:50 +01:00
|
|
|
// Meta info about a segment
|
|
|
|
type Meta struct {
|
|
|
|
Modified time.Time
|
|
|
|
Expiration time.Time
|
|
|
|
Size int64
|
|
|
|
Data []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
// ListItem is a single item in a listing
|
|
|
|
type ListItem struct {
|
|
|
|
Path paths.Path
|
|
|
|
Meta Meta
|
|
|
|
}
|
|
|
|
|
2018-07-16 21:44:28 +01:00
|
|
|
// Store for streams
|
|
|
|
type Store interface {
|
2018-07-30 19:57:50 +01:00
|
|
|
Meta(ctx context.Context, path paths.Path) (Meta, error)
|
|
|
|
Get(ctx context.Context, path paths.Path) (ranger.RangeCloser, Meta, error)
|
2018-07-16 21:44:28 +01:00
|
|
|
Put(ctx context.Context, path paths.Path, data io.Reader,
|
2018-07-30 19:57:50 +01:00
|
|
|
metadata []byte, expiration time.Time) (Meta, error)
|
2018-07-16 21:44:28 +01:00
|
|
|
Delete(ctx context.Context, path paths.Path) error
|
|
|
|
List(ctx context.Context, prefix, startAfter, endBefore paths.Path,
|
2018-07-30 19:57:50 +01:00
|
|
|
recursive bool, limit int, metaFlags uint32) (items []ListItem,
|
2018-07-16 21:44:28 +01:00
|
|
|
more bool, err error)
|
|
|
|
}
|