Documentation
¶
Overview ¶
Package reductgo provides functionality for managing Reduct object storage, including client operations, bucket management
Index ¶
- type Batch
- func (b *Batch) Add(ts int64, data []byte, contentType string, labels LabelMap)
- func (b *Batch) AddOnlyLabels(ts int64, labels LabelMap)
- func (b *Batch) AddOnlyTimestamp(ts int64)
- func (b *Batch) Clear()
- func (b *Batch) LastAccessTime() time.Time
- func (b *Batch) RecordCount() int
- func (b *Batch) Size() int64
- func (b *Batch) Write(ctx context.Context) (ErrorMap, error)
- type BatchOptions
- type BatchType
- type Bucket
- func (b *Bucket) BeginMetadataRead(ctx context.Context, entry string, ts *int64) (*ReadableRecord, error)
- func (b *Bucket) BeginRead(ctx context.Context, entry string, ts *int64) (*ReadableRecord, error)
- func (b *Bucket) BeginRemoveBatch(_ context.Context, entry string) *Batch
- func (b *Bucket) BeginRemoveRecordBatch(_ context.Context) *RecordBatch
- func (b *Bucket) BeginUpdateBatch(_ context.Context, entry string) *Batch
- func (b *Bucket) BeginUpdateRecordBatch(_ context.Context) *RecordBatch
- func (b *Bucket) BeginWrite(_ context.Context, entry string, options *WriteOptions) *WritableRecord
- func (b *Bucket) BeginWriteBatch(_ context.Context, entry string) *Batch
- func (b *Bucket) BeginWriteRecordBatch(_ context.Context) *RecordBatch
- func (b *Bucket) CheckExists(ctx context.Context) (bool, error)
- func (b *Bucket) CreateQueryLink(ctx context.Context, entry string, options QueryLinkOptions) (string, error)
- func (b *Bucket) CreateQueryLinkMany(ctx context.Context, entries []string, options QueryLinkOptions) (string, error)
- func (b *Bucket) GetEntries(ctx context.Context) ([]model.EntryInfo, error)
- func (b *Bucket) GetFullInfo(ctx context.Context) (model.FullBucketDetail, error)
- func (b *Bucket) GetInfo(ctx context.Context) (model.BucketInfo, error)
- func (b *Bucket) GetSettings(ctx context.Context) (model.BucketSetting, error)
- func (b *Bucket) Query(ctx context.Context, entry string, options *QueryOptions) (*QueryResult, error)
- func (b *Bucket) QueryMany(ctx context.Context, entries []string, options *QueryOptions) (*QueryResult, error)
- func (b *Bucket) Remove(ctx context.Context) error
- func (b *Bucket) RemoveEntry(ctx context.Context, entry string) error
- func (b *Bucket) RemoveQuery(ctx context.Context, entry string, options *QueryOptions) (int64, error)
- func (b *Bucket) RemoveQueryMany(ctx context.Context, entries []string, options *QueryOptions) (int64, error)
- func (b *Bucket) RemoveRecord(ctx context.Context, entry string, ts int64) error
- func (b *Bucket) Rename(ctx context.Context, newName string) error
- func (b *Bucket) RenameEntry(ctx context.Context, entry, newName string) error
- func (b *Bucket) SetSettings(ctx context.Context, settings model.BucketSetting) error
- func (b *Bucket) Update(ctx context.Context, entry string, ts int64, labels LabelMap) error
- type Client
- type ClientOptions
- type ErrorMap
- type LabelMap
- type QueryLinkOptions
- type QueryLinkOptionsBuilder
- func (q *QueryLinkOptionsBuilder) Build() QueryLinkOptions
- func (q *QueryLinkOptionsBuilder) WithBaseURL(baseURL string) *QueryLinkOptionsBuilder
- func (q *QueryLinkOptionsBuilder) WithExpireAt(expireAt int64) *QueryLinkOptionsBuilder
- func (q *QueryLinkOptionsBuilder) WithFileName(fileName string) *QueryLinkOptionsBuilder
- func (q *QueryLinkOptionsBuilder) WithQueryOptions(queryOptions QueryOptions) *QueryLinkOptionsBuilder
- func (q *QueryLinkOptionsBuilder) WithRecordIndex(recordIndex int) *QueryLinkOptionsBuilder
- type QueryOptions
- type QueryOptionsBuilder
- func (q *QueryOptionsBuilder) Build() QueryOptions
- func (q *QueryOptionsBuilder) WithContinuous(continuous bool) *QueryOptionsBuilder
- func (q *QueryOptionsBuilder) WithExt(ext any) *QueryOptionsBuilder
- func (q *QueryOptionsBuilder) WithHead(head bool) *QueryOptionsBuilder
- func (q *QueryOptionsBuilder) WithPollInterval(pollInterval time.Duration) *QueryOptionsBuilder
- func (q *QueryOptionsBuilder) WithStart(start int64) *QueryOptionsBuilder
- func (q *QueryOptionsBuilder) WithStop(stop int64) *QueryOptionsBuilder
- func (q *QueryOptionsBuilder) WithStrict(strict bool) *QueryOptionsBuilder
- func (q *QueryOptionsBuilder) WithWhen(when any) *QueryOptionsBuilder
- type QueryResponse
- type QueryResult
- type QueryType
- type ReadableRecord
- func (r *ReadableRecord) ContentType() string
- func (r *ReadableRecord) Entry() string
- func (r *ReadableRecord) IsLast() bool
- func (r *ReadableRecord) IsLastInBatch() bool
- func (r *ReadableRecord) Labels() LabelMap
- func (r *ReadableRecord) Read() ([]byte, error)
- func (r *ReadableRecord) ReadAsString() (string, error)
- func (r *ReadableRecord) SetLastInBatch(last bool)
- func (r *ReadableRecord) Size() int64
- func (r *ReadableRecord) Stream() io.Reader
- func (r *ReadableRecord) Time() int64
- type Record
- type RecordBatch
- func (b *RecordBatch) Add(entry string, ts int64, data []byte, contentType string, labels LabelMap)
- func (b *RecordBatch) AddOnlyLabels(entry string, ts int64, labels LabelMap)
- func (b *RecordBatch) AddOnlyTimestamp(entry string, ts int64)
- func (b *RecordBatch) Clear()
- func (b *RecordBatch) LastAccessTime() time.Time
- func (b *RecordBatch) RecordCount() int
- func (b *RecordBatch) Send(ctx context.Context) (RecordBatchErrorMap, error)
- func (b *RecordBatch) Size() int64
- type RecordBatchErrorMap
- type ReductClient
- func (c *ReductClient) CheckBucketExists(ctx context.Context, name string) (bool, error)
- func (c *ReductClient) CreateBucket(ctx context.Context, name string, settings *model.BucketSetting) (Bucket, error)
- func (c *ReductClient) CreateOrGetBucket(ctx context.Context, name string, settings *model.BucketSetting) (Bucket, error)
- func (c *ReductClient) CreateReplicationTask(ctx context.Context, name string, task model.ReplicationSettings) error
- func (c *ReductClient) CreateToken(ctx context.Context, name string, permissions model.TokenPermissions) (string, error)
- func (c *ReductClient) GetBucket(ctx context.Context, name string) (Bucket, error)
- func (c *ReductClient) GetBuckets(ctx context.Context) ([]model.BucketInfo, error)
- func (c *ReductClient) GetCurrentToken(ctx context.Context) (model.Token, error)
- func (c *ReductClient) GetInfo(ctx context.Context) (model.ServerInfo, error)
- func (c *ReductClient) GetReplicationTask(ctx context.Context, name string) (model.FullReplicationInfo, error)
- func (c *ReductClient) GetReplicationTasks(ctx context.Context) ([]model.ReplicationInfo, error)
- func (c *ReductClient) GetToken(ctx context.Context, name string) (model.Token, error)
- func (c *ReductClient) GetTokens(ctx context.Context) ([]model.Token, error)
- func (c *ReductClient) IsLive(ctx context.Context) (bool, error)
- func (c *ReductClient) RemoveBucket(ctx context.Context, name string) error
- func (c *ReductClient) RemoveReplicationTask(ctx context.Context, name string) error
- func (c *ReductClient) RemoveToken(ctx context.Context, name string) error
- func (c *ReductClient) SetReplicationMode(ctx context.Context, name string, mode model.ReplicationMode) error
- func (c *ReductClient) UpdateReplicationTask(ctx context.Context, name string, task model.ReplicationSettings) error
- type WritableRecord
- type WriteOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
func (*Batch) AddOnlyLabels ¶
AddOnlyLabels adds an empty record with only labels.
func (*Batch) AddOnlyTimestamp ¶
AddOnlyTimestamp adds an empty record with only a timestamp.
func (*Batch) Clear ¶
func (b *Batch) Clear()
Clear removes all records from the batch and resets its state.
func (*Batch) LastAccessTime ¶
LastAccessTime returns the last access time of the batch.
func (*Batch) RecordCount ¶
RecordCount returns the number of records in the batch.
type BatchOptions ¶
type BatchOptions struct{}
type Bucket ¶
type Bucket struct {
HTTPClient httpclient.HTTPClient
Name string
}
func (*Bucket) BeginMetadataRead ¶ added in v0.0.7
func (b *Bucket) BeginMetadataRead(ctx context.Context, entry string, ts *int64) (*ReadableRecord, error)
BeginMetadataRead starts reading only the metadata of a record from the given entry at the specified timestamp.
Parameters:
- ctx: Context for cancellation and timeout control.
- entry: Name of the entry to read from.
- ts: Optional A UNIX timestamp in microseconds. If it is empty, the latest record is returned.
It returns a readableRecord or an error if the read fails.
Use readableRecord.Read() to read the content of the reader.
func (*Bucket) BeginRead ¶
BeginRead starts reading a record from the given entry at the specified timestamp.
Parameters:
- ctx: Context for cancellation and timeout control.
- entry: Name of the entry to read from.
- ts: Optional A UNIX timestamp in microseconds. If it is empty, the latest record is returned.
It returns a readableRecord or an error if the read fails.
Use readableRecord.Read() to read the content of the reader.
func (*Bucket) BeginRemoveBatch ¶
func (*Bucket) BeginRemoveRecordBatch ¶ added in v1.18.0
func (b *Bucket) BeginRemoveRecordBatch(_ context.Context) *RecordBatch
BeginRemoveRecordBatch creates a new batch for removing records across entries (Batch Protocol v2).
func (*Bucket) BeginUpdateBatch ¶
func (*Bucket) BeginUpdateRecordBatch ¶ added in v1.18.0
func (b *Bucket) BeginUpdateRecordBatch(_ context.Context) *RecordBatch
BeginUpdateRecordBatch creates a new batch for updating labels across entries (Batch Protocol v2).
func (*Bucket) BeginWrite ¶
func (b *Bucket) BeginWrite(_ context.Context, entry string, options *WriteOptions) *WritableRecord
BeginWrite starts a record writer for an entry.
Parameters:
- entry the name of the entry to write the record to.
- options:
- TimeStamp: timestamp in microseconds, it is set to current time if not provided
- ContentType: "text/plain"
- Labels: record label kev:value pairs {label1: "value1", label2: "value2"}.
func (*Bucket) BeginWriteBatch ¶
func (*Bucket) BeginWriteRecordBatch ¶ added in v1.18.0
func (b *Bucket) BeginWriteRecordBatch(_ context.Context) *RecordBatch
BeginWriteRecordBatch creates a new batch for writing records across multiple entries (Batch Protocol v2).
func (*Bucket) CheckExists ¶
CheckExists checks if the bucket exists on the server.
func (*Bucket) CreateQueryLink ¶ added in v1.17.0
func (b *Bucket) CreateQueryLink(ctx context.Context, entry string, options QueryLinkOptions) (string, error)
CreateQueryLink creates a temporary link to access a specific record from a query.
Parameters:
- ctx: Context for cancellation and timeout control
- entry: Name of the entry to query
- options: Options for the query link, including query parameters, record index, expiration time, and file name
func (*Bucket) CreateQueryLinkMany ¶ added in v1.18.0
func (b *Bucket) CreateQueryLinkMany(ctx context.Context, entries []string, options QueryLinkOptions) (string, error)
CreateQueryLinkMany creates a temporary link to access records from a query across multiple entries.
Parameters:
- ctx: Context for cancellation and timeout control
- entries: Names of the entries to query
- options: Options for the query link, including query parameters, record index, expiration time, and file name
func (*Bucket) GetEntries ¶ added in v1.15.0
GetEntries retrieves the list of entries and their information in the bucket.
func (*Bucket) GetFullInfo ¶ added in v1.15.0
GetFullInfo retrieves the full details of the bucket, including its settings and entries.
func (*Bucket) GetInfo ¶
GetInfo retrieves the basic information about the bucket, such as its name, size, and quota.
func (*Bucket) GetSettings ¶
GetSettings retrieves the settings of the bucket.
func (*Bucket) Query ¶
func (b *Bucket) Query(ctx context.Context, entry string, options *QueryOptions) (*QueryResult, error)
Query queries records for a time interval and returns them through a channel
Parameters:
- ctx: Context for cancellation and timeout control
- entry: Name of the entry to query. Wildcards are allowed (e.g. "acc-*").
- options: Optional query options for filtering and controlling the query behavior
Example:
records, err := bucket.Query(ctx, "entry-1", nil)
if err != nil {
return err
}
for record := range records {
fmt.Printf("Time: %d, Size: %d\n", record.Time(), record.Size())
fmt.Printf("Labels: %v\n", record.Labels())
content, err := record.Read()
if err != nil {
return err
}
// Process content...
}
func (*Bucket) QueryMany ¶ added in v1.18.0
func (b *Bucket) QueryMany(ctx context.Context, entries []string, options *QueryOptions) (*QueryResult, error)
QueryMany queries records for multiple entries and returns them through a channel.
Parameters:
- ctx: Context for cancellation and timeout control
- entries: Names of the entries to query
- options: Optional query options for filtering and controlling the query behavior
func (*Bucket) RemoveEntry ¶ added in v1.15.0
RemoveEntry removes an entry from the bucket and all its records.
Parameters:
- ctx: Context for cancellation and timeout control.
- entry: Name of the entry to remove.
func (*Bucket) RemoveQuery ¶
func (b *Bucket) RemoveQuery(ctx context.Context, entry string, options *QueryOptions) (int64, error)
RemoveQuery removes records by query.
Parameters:
- ctx: Context for cancellation and timeout control
- entry: Name of the entry
- start: Optional start point of the time period in microseconds. If nil, starts from the first record
- end: Optional end point of the time period in microseconds. If nil, ends at the last record
- options: Optional query options. Only When and Ext fields are used, other options are ignored
Note: remove is exclusive of the end point. [start, end) Returns the number of records removed.
func (*Bucket) RemoveQueryMany ¶ added in v1.18.0
func (b *Bucket) RemoveQueryMany(ctx context.Context, entries []string, options *QueryOptions) (int64, error)
RemoveQueryMany removes records by query for multiple entries.
Parameters:
- ctx: Context for cancellation and timeout control
- entries: Names of the entries
- options: Optional query options. Only When and Ext fields are used, other options are ignored
Note: remove is exclusive of the end point. [start, end) Returns the number of records removed.
func (*Bucket) RemoveRecord ¶ added in v1.15.0
RemoveRecord removes a record from the bucket.
Parameters:
- ctx: Context for cancellation and timeout control.
- entry: Name of the entry to remove the record from.
- ts: Timestamp of the record to remove in microseconds.
func (*Bucket) RenameEntry ¶ added in v1.15.0
RenameEntry renames an entry.
Parameters:
- ctx: Context for cancellation and timeout control.
- entry: Name of the entry to rename.
- newName: New name of the entry.
func (*Bucket) SetSettings ¶
SetSettings updates the settings of the bucket.
type Client ¶
type Client interface {
// Get Info
GetInfo(ctx context.Context) (model.ServerInfo, error)
// Check if the storage engine is working
IsLive(ctx context.Context) (bool, error)
// Get a list of the buckets with their stats
GetBuckets(ctx context.Context) ([]model.BucketInfo, error)
// Create a new bucket
CreateBucket(ctx context.Context, name string, settings *model.BucketSetting) (Bucket, error)
// Create a new bucket if it doesn't exist and return it
CreateOrGetBucket(ctx context.Context, name string, settings *model.BucketSetting) (Bucket, error)
// Get a bucket
GetBucket(ctx context.Context, name string) (Bucket, error)
// Check if a bucket exists
CheckBucketExists(ctx context.Context, name string) (bool, error)
// Remove a bucket
RemoveBucket(ctx context.Context, name string) error
// Get a list of Tokens
GetTokens(ctx context.Context) ([]model.Token, error)
// Show Information about a Token
GetToken(ctx context.Context, name string) (model.Token, error)
// Create a New Token
CreateToken(ctx context.Context, name string, permissions model.TokenPermissions) (string, error)
// Remove a Token
RemoveToken(ctx context.Context, name string) error
// Get Full Information about Current API Token
GetCurrentToken(ctx context.Context) (model.Token, error)
// Get a list of Replication Tasks
GetReplicationTasks(ctx context.Context) ([]model.ReplicationInfo, error)
// Get a Replication Task
GetReplicationTask(ctx context.Context, name string) (model.FullReplicationInfo, error)
// Create a Replication Task
CreateReplicationTask(ctx context.Context, name string, task model.ReplicationSettings) error
// Update a Replication Task
UpdateReplicationTask(ctx context.Context, name string, task model.ReplicationSettings) error
// Set the mode of a Replication Task
SetReplicationMode(ctx context.Context, name string, mode model.ReplicationMode) error
// Remove a Replication Task
RemoveReplicationTask(ctx context.Context, name string) error
}
this is a client for a ReductStore instance.
func NewClient ¶
func NewClient(url string, options ClientOptions) Client
NewClient creates a new ReductClient.
type ClientOptions ¶
type QueryLinkOptions ¶ added in v1.17.0
type QueryLinkOptionsBuilder ¶ added in v1.17.0
type QueryLinkOptionsBuilder struct {
// contains filtered or unexported fields
}
func NewQueryLinkOptionsBuilder ¶ added in v1.17.0
func NewQueryLinkOptionsBuilder() *QueryLinkOptionsBuilder
NewQueryLinkOptionsBuilder creates a new QueryLinkOptionsBuilder with default values. Default values:
- recordIndex: 0 (first record)
- expireAt: 24 hours from now
func (*QueryLinkOptionsBuilder) Build ¶ added in v1.17.0
func (q *QueryLinkOptionsBuilder) Build() QueryLinkOptions
func (*QueryLinkOptionsBuilder) WithBaseURL ¶ added in v1.17.1
func (q *QueryLinkOptionsBuilder) WithBaseURL(baseURL string) *QueryLinkOptionsBuilder
func (*QueryLinkOptionsBuilder) WithExpireAt ¶ added in v1.17.0
func (q *QueryLinkOptionsBuilder) WithExpireAt(expireAt int64) *QueryLinkOptionsBuilder
func (*QueryLinkOptionsBuilder) WithFileName ¶ added in v1.17.0
func (q *QueryLinkOptionsBuilder) WithFileName(fileName string) *QueryLinkOptionsBuilder
func (*QueryLinkOptionsBuilder) WithQueryOptions ¶ added in v1.17.0
func (q *QueryLinkOptionsBuilder) WithQueryOptions(queryOptions QueryOptions) *QueryLinkOptionsBuilder
func (*QueryLinkOptionsBuilder) WithRecordIndex ¶ added in v1.17.0
func (q *QueryLinkOptionsBuilder) WithRecordIndex(recordIndex int) *QueryLinkOptionsBuilder
type QueryOptions ¶
type QueryOptions struct {
QueryType QueryType `json:"query_type"`
Start int64 `json:"start,omitempty"`
Stop int64 `json:"stop,omitempty"`
When any `json:"when,omitempty"`
Ext any `json:"ext,omitempty"`
Strict bool `json:"strict,omitempty"`
Continuous bool `json:"continuous,omitempty"`
Head bool `json:"head,omitempty"`
PollInterval time.Duration `json:"-"`
}
QueryOptions represents a query to run on an entry.
type QueryOptionsBuilder ¶ added in v0.0.3
type QueryOptionsBuilder struct {
// contains filtered or unexported fields
}
func NewQueryOptionsBuilder ¶ added in v0.0.3
func NewQueryOptionsBuilder() *QueryOptionsBuilder
func (*QueryOptionsBuilder) Build ¶ added in v0.0.3
func (q *QueryOptionsBuilder) Build() QueryOptions
Build builds the QueryOptions from the builder.
func (*QueryOptionsBuilder) WithContinuous ¶ added in v0.0.3
func (q *QueryOptionsBuilder) WithContinuous(continuous bool) *QueryOptionsBuilder
WithContinuous WithQueryType makes the query continuous. If set, the query doesn't finish if no records are found and waits for new records to be added. Returns the QueryOptionsBuilder to allow method chaining.
func (*QueryOptionsBuilder) WithExt ¶ added in v0.0.3
func (q *QueryOptionsBuilder) WithExt(ext any) *QueryOptionsBuilder
WithExt sets the ext field for the query to pass additional parameters to extensions Returns the QueryOptionsBuilder to allow method chaining.
func (*QueryOptionsBuilder) WithHead ¶ added in v0.0.3
func (q *QueryOptionsBuilder) WithHead(head bool) *QueryOptionsBuilder
WithHead if set to true, only metadata is fetched without the content. Returns the QueryOptionsBuilder to allow method chaining.
func (*QueryOptionsBuilder) WithPollInterval ¶ added in v0.0.3
func (q *QueryOptionsBuilder) WithPollInterval(pollInterval time.Duration) *QueryOptionsBuilder
WithPollInterval sets the interval for polling the query if it is continuous. Returns the QueryOptionsBuilder to allow method chaining.
func (*QueryOptionsBuilder) WithStart ¶ added in v0.0.3
func (q *QueryOptionsBuilder) WithStart(start int64) *QueryOptionsBuilder
WithStart sets the start timestamp (in microseconds) for the query. Returns the QueryOptionsBuilder to allow method chaining.
func (*QueryOptionsBuilder) WithStop ¶ added in v0.0.3
func (q *QueryOptionsBuilder) WithStop(stop int64) *QueryOptionsBuilder
WithStop sets the stop timestamp (in microseconds) for the query. Returns the QueryOptionsBuilder to allow method chaining.
func (*QueryOptionsBuilder) WithStrict ¶ added in v0.0.3
func (q *QueryOptionsBuilder) WithStrict(strict bool) *QueryOptionsBuilder
WithStrict sets the strict mode for the query. Returns the QueryOptionsBuilder to allow method chaining.
func (*QueryOptionsBuilder) WithWhen ¶ added in v0.0.3
func (q *QueryOptionsBuilder) WithWhen(when any) *QueryOptionsBuilder
WithWhen sets the when condition for the query. Example: map[string]any{"&label": map[string]any{"$eq": "test"}} Returns the QueryOptionsBuilder to allow method chaining.
type QueryResponse ¶
type QueryResponse struct {
ID int64 `json:"id,omitempty"`
RemovedRecords int64 `json:"removed_records,omitempty"`
}
QueryResponse represents the response from a query operation.
type QueryResult ¶
type QueryResult struct {
// contains filtered or unexported fields
}
func (*QueryResult) Records ¶
func (q *QueryResult) Records() <-chan *ReadableRecord
type ReadableRecord ¶
type ReadableRecord struct {
// contains filtered or unexported fields
}
func NewReadableRecord ¶
func (*ReadableRecord) ContentType ¶
func (r *ReadableRecord) ContentType() string
ContentType returns the content type of the record.
func (*ReadableRecord) Entry ¶ added in v1.18.0
func (r *ReadableRecord) Entry() string
Entry returns the entry name of the record.
func (*ReadableRecord) IsLast ¶
func (r *ReadableRecord) IsLast() bool
IsLast is true if this is the last record in the query.
This is not the same as IsLastInBatch(), which is true if this is the last record in the batch.
func (*ReadableRecord) IsLastInBatch ¶ added in v0.0.8
func (r *ReadableRecord) IsLastInBatch() bool
IsLastInBatch is true if this is the last record in the batch.
This is not the same as IsLast(), which is true if this is the last record in the query. use this to check if the record is the last in the batch which has to be processed in a stream.
func (*ReadableRecord) Labels ¶
func (r *ReadableRecord) Labels() LabelMap
Labels returns the labels of the record.
func (*ReadableRecord) Read ¶
func (r *ReadableRecord) Read() ([]byte, error)
Read reads the record from the stream.
note: calling read on last record will return no error, but may return empty data.
calling this method on a last record is not recommended, use Stream().Read() instead.
func (*ReadableRecord) ReadAsString ¶
func (r *ReadableRecord) ReadAsString() (string, error)
ReadAsString reads the record from the stream and returns it as a string.
use this to read the record at once.
func (*ReadableRecord) SetLastInBatch ¶ added in v1.18.0
func (r *ReadableRecord) SetLastInBatch(last bool)
SetLastInBatch sets whether the record is the last one in a batch.
func (*ReadableRecord) Size ¶
func (r *ReadableRecord) Size() int64
Size returns the size of the record.
func (*ReadableRecord) Stream ¶
func (r *ReadableRecord) Stream() io.Reader
Stream returns the stream of the record.
use this to read the record in a stream.
func (*ReadableRecord) Time ¶
func (r *ReadableRecord) Time() int64
Time returns the timestamp of the record.
type RecordBatch ¶ added in v1.18.0
type RecordBatch struct {
// contains filtered or unexported fields
}
RecordBatch is a batch of records across multiple entries (Batch Protocol v2).
func (*RecordBatch) AddOnlyLabels ¶ added in v1.18.0
func (b *RecordBatch) AddOnlyLabels(entry string, ts int64, labels LabelMap)
AddOnlyLabels adds an empty record with only labels for update/remove operations.
func (*RecordBatch) AddOnlyTimestamp ¶ added in v1.18.0
func (b *RecordBatch) AddOnlyTimestamp(entry string, ts int64)
AddOnlyTimestamp adds an empty record with only a timestamp for remove operations.
func (*RecordBatch) LastAccessTime ¶ added in v1.18.0
func (b *RecordBatch) LastAccessTime() time.Time
LastAccessTime returns the last access time of the batch.
func (*RecordBatch) RecordCount ¶ added in v1.18.0
func (b *RecordBatch) RecordCount() int
RecordCount returns the number of records in the batch.
func (*RecordBatch) Send ¶ added in v1.18.0
func (b *RecordBatch) Send(ctx context.Context) (RecordBatchErrorMap, error)
Send sends the batch to the server using Batch Protocol v2.
func (*RecordBatch) Size ¶ added in v1.18.0
func (b *RecordBatch) Size() int64
Size returns the total size of the batch.
type RecordBatchErrorMap ¶ added in v1.18.0
RecordBatchErrorMap represents errors per entry and timestamp.
type ReductClient ¶
type ReductClient struct {
APIToken string
// this is a custom http client
HTTPClient httpclient.HTTPClient
// contains filtered or unexported fields
}
func (*ReductClient) CheckBucketExists ¶
CheckBucketExists checks if a bucket exists.
func (*ReductClient) CreateBucket ¶
func (c *ReductClient) CreateBucket(ctx context.Context, name string, settings *model.BucketSetting) (Bucket, error)
func (*ReductClient) CreateOrGetBucket ¶
func (c *ReductClient) CreateOrGetBucket(ctx context.Context, name string, settings *model.BucketSetting) (Bucket, error)
func (*ReductClient) CreateReplicationTask ¶ added in v0.0.3
func (c *ReductClient) CreateReplicationTask(ctx context.Context, name string, task model.ReplicationSettings) error
CreateReplicationTask creates a new replication task.
func (*ReductClient) CreateToken ¶ added in v0.0.3
func (c *ReductClient) CreateToken(ctx context.Context, name string, permissions model.TokenPermissions) (string, error)
CreateToken creates a new token.
func (*ReductClient) GetBuckets ¶ added in v0.0.2
func (c *ReductClient) GetBuckets(ctx context.Context) ([]model.BucketInfo, error)
GetBuckets returns a list of buckets with their stats.
func (*ReductClient) GetCurrentToken ¶ added in v0.0.3
GetCurrentToken returns the current token.
func (*ReductClient) GetInfo ¶ added in v0.0.2
func (c *ReductClient) GetInfo(ctx context.Context) (model.ServerInfo, error)
GetInfo returns information about the server.
func (*ReductClient) GetReplicationTask ¶ added in v0.0.3
func (c *ReductClient) GetReplicationTask(ctx context.Context, name string) (model.FullReplicationInfo, error)
GetReplicationTask returns a replication task.
func (*ReductClient) GetReplicationTasks ¶ added in v0.0.3
func (c *ReductClient) GetReplicationTasks(ctx context.Context) ([]model.ReplicationInfo, error)
GetReplicationTasks returns a list of replication tasks.
func (*ReductClient) IsLive ¶ added in v0.0.2
func (c *ReductClient) IsLive(ctx context.Context) (bool, error)
IsLive checks if the server is live.
func (*ReductClient) RemoveBucket ¶
func (c *ReductClient) RemoveBucket(ctx context.Context, name string) error
RemoveBucket removes a bucket.
func (*ReductClient) RemoveReplicationTask ¶ added in v0.0.3
func (c *ReductClient) RemoveReplicationTask(ctx context.Context, name string) error
RemoveReplicationTask removes a replication task.
func (*ReductClient) RemoveToken ¶ added in v0.0.3
func (c *ReductClient) RemoveToken(ctx context.Context, name string) error
RemoveToken removes a token.
func (*ReductClient) SetReplicationMode ¶ added in v1.18.0
func (c *ReductClient) SetReplicationMode(ctx context.Context, name string, mode model.ReplicationMode) error
SetReplicationMode updates the mode of an existing replication task.
func (*ReductClient) UpdateReplicationTask ¶ added in v0.0.3
func (c *ReductClient) UpdateReplicationTask(ctx context.Context, name string, task model.ReplicationSettings) error
UpdateReplicationTask updates an existing replication task.
type WritableRecord ¶
type WritableRecord struct {
// contains filtered or unexported fields
}
func NewWritableRecord ¶
func NewWritableRecord(bucketName string, entryName string, httpClient httpclient.HTTPClient, options WriteOptions, ) *WritableRecord
func (*WritableRecord) Write ¶
func (w *WritableRecord) Write(data any) error
Write writes the record to the bucket.
data can be a string, []byte, or io.Reader. size is the size of the data to write. if size is not provided, it will be calculated from the data.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package model defines the core data structures (models) used throughout the application.
|
Package model defines the core data structures (models) used throughout the application. |