data

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetCursorOpts

type GetCursorOpts struct {
	// Name of the stream.
	StreamName string `q:"stream-name"`
	// Partition ID of the stream. The value can be in either of the following formats:
	// shardId-00000000000
	// For example, if a stream has three partitions, the partition identifiers are 0, 1, and 2,
	// or shardId-0000000000, shardId-0000000001, and shardId-0000000002, respectively.
	PartitionId string `q:"partition-id"`
	// Cursor type.
	// AT_SEQUENCE_NUMBER: Data is read from the position denoted by a specific sequence number
	// (that is defined by starting-sequence-number). This is the default cursor type.
	// AFTER_SEQUENCE_NUMBER: Data is read right after the position denoted by a specific sequence number
	// (that is defined by starting-sequence-number).
	// TRIM_HORIZON: Data is read from the earliest data record in the partition.
	// For example, a tenant uses a DIS stream to upload three pieces of data A1, A2, and A3. N days later,
	// A1 has expired and A2 and A3 are still in the validity period.
	// In this case, if the tenant uses TRIM_HORIZON to download the data, the system downloads data from A2.
	// LATEST: Data is read from the latest record in the partition.
	// This setting ensures that you always read the latest record in the partition.
	// AT_TIMESTAMP: Data is read from the position denoted by a specific timestamp.
	// Enumeration values:
	// AT_SEQUENCE_NUMBER
	// AFTER_SEQUENCE_NUMBER
	// TRIM_HORIZON
	// LATEST
	// AT_TIMESTAMP
	CursorType string `q:"cursor-type,omitempty"`
	// Serial number. A sequence number is a unique identifier for each record.
	// DIS automatically allocates a sequence number when the data producer calls the PutRecords operation to add data to the DIS stream.
	// SN of the same partition key usually changes with time.
	// A longer interval between PutRecords requests results in a larger sequence number.
	// The sequence number is closely related to cursor types AT_SEQUENCE_NUMBER and AFTER_SEQUENCE_NUMBER.
	// The two parameters determine the position of the data to be read.
	// Value range: 0 to 9,223,372,036,854,775,807
	StartingSequenceNumber string `q:"starting-sequence-number,omitempty"`
	// Timestamp when the data record starts to be read, which is closely related to cursor type AT_TIMESTAMP.
	// The two parameters determine the position of the data to be read.
	// Note:
	// The timestamp is accurate to milliseconds.
	Timestamp *int64 `q:"timestamp,omitempty"`
	// Unique ID of the stream. This parameter is mandatory for obtaining the iterator of an authorized stream.
	StreamId string `q:"stream-id,omitempty"`
}

type GetCursorResponse

type GetCursorResponse struct {
	// Data cursor. Value range: a string of 1 to 512 characters
	// Note:
	// The validity period of a data cursor is 5 minutes.
	// Minimum: 1
	// Maximum: 512
	PartitionCursor string `json:"partition_cursor,omitempty"`
}

func GetCursor

func GetCursor(client *golangsdk.ServiceClient, opts GetCursorOpts) (*GetCursorResponse, error)

type GetRecordsOpts

type GetRecordsOpts struct {
	// Data cursor, which needs to be obtained through the API for obtaining data cursors.
	// Value range: a string of 1 to 512 characters
	// Note:
	// The validity period of a data cursor is 5 minutes.
	PartitionCursor string `q:"partition-cursor"`
	// Maximum number of bytes that can be obtained for each request.
	// Note:
	// If the value is less than the size of a single record in the partition, the record cannot be obtained.
	MaxFetchBytes *int `q:"max_fetch_bytes,omitempty"`
}

type GetRecordsResponse

type GetRecordsResponse struct {
	Records []Record `json:"records,omitempty"`
	// Next iterator.
	// Note:
	// The validity period of a data cursor is 5 minutes.
	NextPartitionCursor string `json:"next_partition_cursor,omitempty"`
}

func GetRecords

func GetRecords(client *golangsdk.ServiceClient, opts GetRecordsOpts) (*GetRecordsResponse, error)

type PutRecordsOpts

type PutRecordsOpts struct {
	// Name of the stream.
	// Maximum: 64
	StreamName string `json:"stream_name" required:"true"`
	// Unique ID of the stream.
	// If no stream is found by stream_name and stream_id is not empty, stream_id is used to search for the stream.
	// Note:
	// This parameter is mandatory when data is uploaded to the authorized stream.
	StreamId string `json:"stream_id,omitempty"`
	// List of records to be uploaded.
	Records []PutRecordsRequestEntry `json:"records" required:"true"`
}

type PutRecordsRequestEntry

type PutRecordsRequestEntry struct {
	// Data to be uploaded. The uploaded data is the serialized binary data (character string encoded using Base64).
	// For example, if the character string data needs to be uploaded, the character string after Base64 encoding is ZGF0YQ==.
	Data string `json:"data"`
	// Hash value of the data to be written to the partition. The hash value overwrites the hash value of partition_key. Value range: 0–long.max
	ExplicitHashKey string `json:"explicit_hash_key,omitempty"`
	// Partition ID of the stream. The value can be in either of the following formats:
	// shardId-0000000000
	// 0
	// For example, if a stream has three partitions, the partition identifiers are 0, 1, and 2, or shardId-0000000000, shardId-0000000001, and shardId-0000000002, respectively.
	PartitionId string `json:"partition_id,omitempty"`
	// Partition to which data is written to. Note:
	// If the partition_id parameter is transferred, the partition_id parameter is used preferentially.
	// If partition_id is not transferred, partition_key is used.
	PartitionKey string `json:"partition_key,omitempty"`
}

type PutRecordsResponse

type PutRecordsResponse struct {
	// Number of data records that fail to be uploaded.
	FailedRecordCount *int `json:"failed_record_count,omitempty"`

	Records []PutRecordsResultEntry `json:"records,omitempty"`
}

func PutRecords

func PutRecords(client *golangsdk.ServiceClient, opts PutRecordsOpts) (*PutRecordsResponse, error)

type PutRecordsResultEntry

type PutRecordsResultEntry struct {
	// ID of the partition to which data is uploaded.
	PartitionId string `json:"partition_id,omitempty"`
	// Sequence number of the data to be uploaded.
	// A sequence number is a unique identifier for each record.
	// DIS automatically allocates a sequence number the data producer calls the PutRecords operation to add data to the DIS stream.
	// Sequence number of the same partition key usually changes with time. A longer interval between PutRecords requests results in a larger sequence number.
	SequenceNumber string `json:"sequence_number,omitempty"`
	// Error code.
	ErrorCode string `json:"error_code,omitempty"`
	// Error message.
	ErrorMessage string `json:"error_message,omitempty"`
}

type Record

type Record struct {
	// Partition key set when data is being uploaded.
	// Note:
	// If the partition_key parameter is passed when data is uploaded, this parameter will be returned when data is downloaded.
	// If partition_id instead of partition_key is passed when data is uploaded, no partition_key is returned.
	PartitionKey string `json:"partition_key,omitempty"`
	// Sequence number of the data record.
	SequenceNumber string `json:"sequence_number,omitempty"`
	// Downloaded data.
	// The downloaded data is the serialized binary data (Base64-encoded character string).
	// For example, the data returned by the data download API is "ZGF0YQ==", which is "data" after Base64 decoding.
	Data string `json:"data,omitempty"`
	// Timestamp when the record is written to DIS.
	CreatedAt *int64 `json:"timestamp,omitempty"`
	// Timestamp data type.
	// CreateTime: creation time.
	// Default: CreateTime
	TimestampType string `json:"timestamp_type,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL