Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultDataPartitionSize = 50000 DefaultDataInterval = time.Hour DefaultDataPrefix = "data" )
Variables ¶
View Source
var ( DefaultPathProvider = NewPathPartitionProvider() DefaultTimeNow = time.Now )
Functions ¶
This section is empty.
Types ¶
type PathPartitionProvider ¶ added in v0.84.0
type PathPartitionProvider struct {
// contains filtered or unexported fields
}
PathPartitionProvider provides path by request to upload data. The provided path is built from '<prefix>/<partition>/<unique id>'. The partition is updated every interval or when the number of IDs generated passes the specified size.
func NewPathPartitionProvider ¶ added in v0.84.0
func NewPathPartitionProvider(opts ...PathProviderOption) *PathPartitionProvider
func (*PathPartitionProvider) NewPath ¶ added in v0.84.0
func (i *PathPartitionProvider) NewPath() string
NewPath returns a new upload path based on the current partition.
func (*PathPartitionProvider) ResolvePathTime ¶ added in v0.90.0
func (i *PathPartitionProvider) ResolvePathTime(address string) (time.Time, error)
type PathProvider ¶ added in v0.84.0
type PathProvider interface { NewPath() string // ResolvePathTime - get string parse it to xid and returns the timestamp part of it ResolvePathTime(address string) (time.Time, error) }
PathProvider captures the requirements from PathPartitionProvider implementation to return a new path
type PathProviderConfig ¶ added in v0.84.0
type PathProviderOption ¶ added in v0.84.0
type PathProviderOption func(o *PathProviderConfig)
func WithPathProviderInterval ¶ added in v0.84.0
func WithPathProviderInterval(d time.Duration) PathProviderOption
func WithPathProviderPrefix ¶ added in v0.84.0
func WithPathProviderPrefix(p string) PathProviderOption
func WithPathProviderSize ¶ added in v0.84.0
func WithPathProviderSize(size int) PathProviderOption
func WithPathProviderTellTime ¶ added in v0.84.0
func WithPathProviderTellTime(t TimeNow) PathProviderOption
Click to show internal directories.
Click to hide internal directories.