yt

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 27 Imported by: 8

Documentation

Overview

Package yt defines interfaces of different YT services.

All API methods follow the same conventions:

  • First argument is context.Context.
  • Last argument is pointer to Options struct.
  • Other arguments are required parameters.

Zero value of every Options struct corresponds to default values of parameters.

You may pass nil as the last argument.

var ctx context.Context
var y yt.Client
p := ypath.Path("//foo/bar/@zog")

// These two calls do the same thing.
y.SetNode(ctx, p, 1, nil)
y.SetNode(ctx, p, 1, &yt.SetNodeOptions{})

By default, client retries all transient errors 5 times. Use context.WithTimeout to provide timeout for api call.

API methods are grouped into interfaces, according to part of the system they interact with:

  • CypressClient - cypress nodes
  • LowLevelTxClient - cypress transactions
  • LockClient - cypress locks
  • LowLevelSchedulerClient - scheduler
  • FileClient - file operations
  • TableClient - table operations
  • AdminClient - misc administrative commands
  • TabletClient - dynamic tables

Finally, yt.Client and yt.Tx provide high level api for transactions and embed interfaces of different subsystems.

Index

Examples

Constants

View Source
const (
	TVMOnlyHTTPProxyPort  = 9026
	TVMOnlyHTTPSProxyPort = 9443
	TVMOnlyRPCProxyPort   = 9027
)
View Source
const (
	DefaultLightRequestTimeout = 5 * time.Minute
	DefaultTxTimeout           = 15 * time.Second
	DefaultTxPingPeriod        = 3 * time.Second
)
View Source
const (
	// XYaServiceTicket is http header that should be used for service ticket transfer.
	XYaServiceTicket = "X-Ya-Service-Ticket"
	// XYaUserTicket is http header that should be used for user ticket transfer.
	XYaUserTicket = "X-Ya-User-Ticket"
	// YTCypressCookie is a cookie that should be used for authentication in open source world.
	YTCypressCookie = "YTCypressCookie"
	// XCSRFToken is a http header that should be used for CSRF token transfer.
	XCSRFToken = "X-Csrf-Token"
)
View Source
const (
	TabletMounted    = "mounted"
	TabletMounting   = "mounting"
	TabletUnmounted  = "unmounted"
	TabletUnmounting = "unmounting"
	TabletFrozen     = "frozen"
	TabletFreezing   = "freezing"
	TabletTransient  = "transient"
)
View Source
const (
	DefaultExecTxRetryCount   = 5
	DefaultExecTxRetryBackoff = time.Second
)
View Source
const (
	DefaultRequestTimeout = 5 * time.Minute
)

Variables

View Source
var NullOperationID = OperationID(guid.FromHalves(0, 0))

Functions

func ApproximateRowCount

func ApproximateRowCount(r TableReader) (count int64, ok bool)

ApproximateRowCount returns approximation of total number of rows in this reader.

Might not be available, depending on the underlying implementation

func ConvertPermissionType

func ConvertPermissionType(typ *Permission) (*int32, error)

func ExecTabletTx

func ExecTabletTx(ctx context.Context, yc Client, f TabletTxFunc, opts *ExecTabletTxOptions) (err error)

ExecTabletTx a convenience method that creates new tablet transaction and executes commit/abort based on the error returned by the callback function.

In case of nil options default ones are used.

Retries could be stopped with the context cancellation.

If f returns a *backoff.PermanentError, the operation is not retried, and the wrapped error is returned.

func ExecTx

func ExecTx(ctx context.Context, yc Client, f TxFunc, opts *ExecTxOptions) (err error)

ExecTx is a convenience method that creates new master transaction and executes commit/abort based on the error returned by the callback function.

In case of nil options default ones are used.

Retries could be stopped with the context cancellation.

If f returns a *backoff.PermanentError, the operation is not retried, and the wrapped error is returned.

func MustConvertPermissionType

func MustConvertPermissionType(typ *Permission) *int32

func NewStaticDiscoverer added in v0.0.10

func NewStaticDiscoverer(conf *DiscoveryConfig) *staticDiscoverer

func PollMaster

func PollMaster(ctx context.Context, yc Client, poll func() (stop bool, err error)) error

PollMaster abstracts away places where you would like to poll state change from the master.

Calls poll in a loop until either, poll() returns an error, poll() signals to stop or ctx is canceled.

func RangeJobs

func RangeJobs(ctx context.Context, yc Client, opID OperationID, opts *ListJobsOptions, cb RangeJobsCallback) error

RangeJobs iterates over operation jobs with pagination and calls cb on each job.

func RangeOperations

func RangeOperations(ctx context.Context, yc Client, opts *ListOperationsOptions, cb RangeOperationsCallback) error

RangeOperations iterates over operations with pagination and calls cb on each operation.

func StartRowIndex

func StartRowIndex(r TableReader) (rowIndex int64, ok bool)

StartRowIndex returns row index of the first row in table reader.

Index might not be available, depending on the underlying implementation

func TrackQuery added in v0.0.10

func TrackQuery(
	ctx context.Context,
	qt QueryTrackerClient,
	id QueryID,
	opts *TrackQueryOptions,
) error

TrackQuery is waiting while Query will get state == "completed" | "failed" | "aborted".

If the opts.PollPeriod is not set, then pollPeriod = defaultTrackPollPeriod. If the opts.Logger is not set, then Logger = nop.Logger

func WebUIOperationURL

func WebUIOperationURL(cluster string, opID OperationID) string

func WebUITableURL

func WebUITableURL(cluster string, path ypath.Path) string

func WithCredentials

func WithCredentials(ctx context.Context, credentials Credentials) context.Context

WithCredentials allows overriding client credentials on per-call basis.

Types

type ACE

type ACE struct {
	Action           SecurityAction `yson:"action,omitempty"`
	Subjects         []string       `yson:"subjects,omitempty"`
	Permissions      []Permission   `yson:"permissions,omitempty"`
	InheritanceMode  string         `yson:"inheritance_mode,omitempty"`
	Columns          []string       `yson:"columns,omitempty"`
	Vital            *bool          `yson:"vital,omitempty"`
	SubjectTagFilter string         `yson:"subject_tag_filter,omitempty"`
}

type AbortOperationOptions

type AbortOperationOptions struct {
	AbortMessage *string `http:"abort_message,omitnil"`
}

type AbortQueryOptions added in v0.0.10

type AbortQueryOptions struct {
	AbortMessage *string `http:"abort_message,omitnil"`

	*QueryTrackerOptions
}

type AbortTxOptions

type AbortTxOptions struct {
	Sticky bool `http:"sticky"`

	*TransactionOptions
	*MutatingOptions
	*PrerequisiteOptions
}

type AccessTrackingOptions

type AccessTrackingOptions struct {
	SuppressAccessTracking       bool `http:"suppress_access_tracking"`
	SuppressModificationTracking bool `http:"suppress_modification_tracking"`
}

AccessTrackingOptions suppresses update of "modification_time", "access_time" and "access_counter" cypress attributes.

type AddMaintenanceOptions added in v0.0.7

type AddMaintenanceOptions struct {
}

type AddMaintenanceResponse added in v0.0.7

type AddMaintenanceResponse struct {
	ID MaintenanceID `yson:"id"`
}

type AddMemberOptions

type AddMemberOptions struct {
	*MutatingOptions
	*PrerequisiteOptions
}

type AdminClient

type AdminClient interface {
	// http:verb:"add_member"
	// http:params:"group","member"
	AddMember(
		ctx context.Context,
		group string,
		member string,
		options *AddMemberOptions,
	) (err error)

	// http:verb:"build_master_snapshots"
	BuildMasterSnapshots(
		ctx context.Context,
		options *BuildMasterSnapshotsOptions,
	) (result *BuildMasterSnapshotsResponse, err error)

	// http:verb:"build_snapshot"
	BuildSnapshot(
		ctx context.Context,
		options *BuildSnapshotOptions,
	) (result *BuildSnapshotResponse, err error)

	// http:verb:"remove_member"
	// http:params:"group","member"
	RemoveMember(
		ctx context.Context,
		group string,
		member string,
		options *RemoveMemberOptions,
	) (err error)

	// http:verb:"add_maintenance"
	// http:params:"component","address","type","comment"
	AddMaintenance(
		ctx context.Context,
		component MaintenanceComponent,
		address string,
		maintenanceType MaintenanceType,
		comment string,
		options *AddMaintenanceOptions,
	) (result *AddMaintenanceResponse, err error)

	// http:verb:"remove_maintenance"
	// http:params:"component","address"
	RemoveMaintenance(
		ctx context.Context,
		component MaintenanceComponent,
		address string,
		options *RemoveMaintenanceOptions,
	) (result *RemoveMaintenanceResponse, err error)

	// http:verb:"transfer_account_resources"
	// http:params:"source_account","destination_account","resource_delta"
	TransferAccountResources(
		ctx context.Context,
		srcAccount string,
		dstAccount string,
		resourceDelta any,
		options *TransferAccountResourcesOptions,
	) (err error)

	// http:verb:"transfer_pool_resources"
	// http:params:"source_pool","destination_pool","pool_tree","resource_delta"
	TransferPoolResources(
		ctx context.Context,
		srcPool string,
		dstPool string,
		poolTree string,
		resourceDelta any,
		options *TransferPoolResourcesOptions,
	) (err error)

	// http:verb:"check_permission"
	// http:params:"user","permission","path"
	CheckPermission(
		ctx context.Context,
		user string,
		permission Permission,
		path ypath.YPath,
		options *CheckPermissionOptions,
	) (result *CheckPermissionResponse, err error)

	// http:verb:"disable_chunk_locations"
	// http:params:"node_address","location_uuids"
	DisableChunkLocations(
		ctx context.Context,
		nodeAddress string,
		locationUUIDs []guid.GUID,
		options *DisableChunkLocationsOptions,
	) (result *DisableChunkLocationsResponse, err error)

	// http:verb:"destroy_chunk_locations"
	// http:params:"node_address","recover_unlinked_disks","location_uuids"
	DestroyChunkLocations(
		ctx context.Context,
		nodeAddress string,
		recoverUnlinkedDisks bool,
		locationUUIDs []guid.GUID,
		options *DestroyChunkLocationsOptions,
	) (result *DestroyChunkLocationsResponse, err error)

	// http:verb:"resurrect_chunk_locations"
	// http:params:"node_address","location_uuids"
	ResurrectChunkLocations(
		ctx context.Context,
		nodeAddress string,
		locationUUIDs []guid.GUID,
		options *ResurrectChunkLocationsOptions,
	) (result *ResurrectChunkLocationsResponse, err error)

	// http:verb:"request_restart"
	// http:params:"node_address"
	RequestRestart(
		ctx context.Context,
		nodeAddress string,
		options *RequestRestartOptions,
	) error
}

type AlterQueryOptions added in v0.0.10

type AlterQueryOptions struct {
	Annotations         any     `http:"annotations,omitnil"`
	AccessControlObject *string `http:"access_control_object,omitnil"`

	*QueryTrackerOptions
}

type AlterTableOptions

type AlterTableOptions struct {
	*MutatingOptions

	Schema            *schema.Schema `http:"schema,omitnil"`
	Dynamic           *bool          `http:"dynamic,omitnil"`
	UpstreamReplicaID *guid.GUID     `http:"upstream_replica_id,omitnil"`
}

type AlterTableReplicaOptions

type AlterTableReplicaOptions struct {
	Enabled *bool             `http:"enabled,omitnil"`
	Mode    *TableReplicaMode `http:"mode,omitnil"`
}

type Atomicity

type Atomicity string
var (
	AtomicityNone Atomicity = "none"
	AtomicityFull Atomicity = "full"
)

type Attribute added in v0.0.10

type Attribute struct {
	Key   string
	Value []byte
}

type AuthClient added in v0.0.17

type AuthClient interface {
	// http:verb:"set_user_password"
	// http:params:"user","new_password_sha256","current_password_sha256"
	SetUserPassword(
		ctx context.Context,
		user string,
		newPassword string,
		currentPassword string,
		options *SetUserPasswordOptions,
	) (err error)

	// http:verb:"issue_token"
	// http:params:"user","password_sha256"
	IssueToken(
		ctx context.Context,
		user string,
		password string,
		options *IssueTokenOptions,
	) (token string, err error)

	// http:verb:"revoke_token"
	// http:params:"user","password_sha256","token_sha256"
	RevokeToken(
		ctx context.Context,
		user string,
		password string,
		token string,
		options *RevokeTokenOptions,
	) error

	// http:verb:"list_user_tokens"
	// http:params:"user","password_sha256"
	ListUserTokens(
		ctx context.Context,
		user string,
		password string,
		options *ListUserTokensOptions,
	) (tokens []string, err error)
}

type BackupManifest added in v0.0.10

type BackupManifest struct {
	Clusters map[string][]TableBackupManifest `yson:"clusters"`
}

type BuildMasterSnapshot added in v0.0.4

type BuildMasterSnapshot struct {
	CellID     guid.GUID `yson:"cell_id"`
	SnapshotID int       `yson:"snapshot_id"`
}

type BuildMasterSnapshotsOptions added in v0.0.4

type BuildMasterSnapshotsOptions struct {
	SetReadOnly               *bool `http:"set_read_only,omitnil"`
	WaitForSnapshotCompletion *bool `http:"wait_for_snapshot_completion,omitnil"`
	Retry                     *bool `http:"retry,omitnil"`
}

type BuildMasterSnapshotsResponse added in v0.0.4

type BuildMasterSnapshotsResponse = []BuildMasterSnapshot

type BuildSnapshotOptions added in v0.0.5

type BuildSnapshotOptions struct {
	CellID                    *guid.GUID `http:"cell_id,omitnil"`
	SetReadOnly               *bool      `http:"set_read_only,omitnil"`
	WaitForSnapshotCompletion *bool      `http:"wait_for_snapshot_completion,omitnil"`
}

type BuildSnapshotResponse added in v0.0.5

type BuildSnapshotResponse struct {
	SnapshotID int `yson:"snapshot_id"`
}

type CheckPermissionOptions

type CheckPermissionOptions struct {
	*TransactionOptions
	*PrerequisiteOptions
	*MasterReadOptions

	Columns []string `http:"columns,omitnil"`
}

type CheckPermissionResponse

type CheckPermissionResponse struct {
	CheckPermissionResult

	Columns []CheckPermissionResult `yson:"columns,omitempty"`
}

type CheckPermissionResult

type CheckPermissionResult struct {
	Action      SecurityAction `yson:"action"`
	ObjectID    NodeID         `yson:"object_id,omitempty"`
	ObjectName  *string        `yson:"object_name,omitempty"`
	SubjectID   NodeID         `yson:"subject_id,omitempty"`
	SubjectName *string        `yson:"subject_name,omitempty"`
}

type ChunkSpec

type ChunkSpec struct {
	ChunkID    guid.GUID        `yson:"chunk_id"`
	RangeIndex int              `yson:"range_index"`
	RowIndex   int              `yson:"row_index"`
	RowCount   int              `yson:"row_count"`
	LowerLimit *ypath.ReadLimit `yson:"lower_limit"`
	UpperLimit *ypath.ReadLimit `yson:"upper_limit"`
	Replicas   []int            `yson:"replicas"`
}

type Client

type Client interface {
	CypressClient
	FileClient
	TableClient

	// BeginTx creates new tx.
	//
	// Tx lifetime is bound to ctx. Tx is automatically aborted when ctx is canceled.
	//
	// Active transaction consumes resources, client must finish transaction by calling Commit(), Abort()
	// or canceling ctx passed to BeginTx.
	BeginTx(ctx context.Context, options *StartTxOptions) (tx Tx, err error)

	// BeginTabletTx creates new tablet transaction.
	//
	// Tx lifetime is bound to ctx. Tx is automatically aborted when ctx is canceled.
	//
	// Active transaction consumes resources, client must finish transaction by calling Commit(), Abort()
	// or canceling ctx passed to BeginTabletTx.
	BeginTabletTx(ctx context.Context, options *StartTabletTxOptions) (tx TabletTx, err error)

	TabletClient
	MountClient
	TableBackupClient

	// http:verb:"generate_timestamp"
	GenerateTimestamp(ctx context.Context, options *GenerateTimestampOptions) (ts Timestamp, err error)

	LowLevelTxClient
	LowLevelSchedulerClient

	AdminClient
	AuthClient

	QueryTrackerClient

	// http:verb:"locate_skynet_share"
	// http:params:"path"
	LocateSkynetShare(
		ctx context.Context,
		path ypath.YPath,
		options *LocateSkynetShareOptions,
	) (l ShareLocation, err error)

	// http:verb:"get_in_sync_replicas"
	// http:params:"path","timestamp"
	// http:extra
	GetInSyncReplicas(
		ctx context.Context,
		path ypath.Path,
		ts Timestamp,
		keys []any,
		options *GetInSyncReplicasOptions,
	) (ids []NodeID, err error)

	NewRowBatchWriter() RowBatchWriter

	// Stop() cancels and waits for completion of all background activity associated with this client.
	//
	// All transactions tracked by this client are aborted.
	Stop()
}

type ClientCompressionCodec

type ClientCompressionCodec int

ClientCompressionCodec. See yt.Config doc for more details.

const (
	// Default compression codec, selected by YT team. Particular choice may change in the future.
	ClientCodecDefault ClientCompressionCodec = iota

	// Use default GZIP codec, provided by net/http.
	ClientCodecGZIP

	// No compression at all. It almost never makes sense to disable compression in production.
	ClientCodecNone

	ClientCodecSnappy

	ClientCodecZSTDFastest
	ClientCodecZSTDDefault
	ClientCodecZSTDBetterCompression

	ClientCodecBrotliFastest
	ClientCodecBrotliDefault
)

func (ClientCompressionCodec) BlockCodec

func (c ClientCompressionCodec) BlockCodec() (string, bool)

type ClusterURL

type ClusterURL struct {
	Address          string
	DisableDiscovery bool
}

func NormalizeProxyURL

func NormalizeProxyURL(proxy string, disableDiscovery bool, tvmOnly bool, tvmOnlyPort int) ClusterURL

type CommitTxOptions

type CommitTxOptions struct {
	Sticky bool `http:"sticky"`

	*MutatingOptions
	*PrerequisiteOptions
	*TransactionOptions
}

type CompleteOperationOptions

type CompleteOperationOptions struct {
}

type Config

type Config struct {
	// Proxy configures address of YT HTTP proxy.
	//
	// If Proxy is not set, value of YT_PROXY environment variable is used instead.
	//
	// Might be equal to cluster name. E.g. hahn or markov.
	//
	// Might be equal to hostname with optional port. E.g. localhost:12345 or sas5-1547-proxy-hahn.sas.yp-c.yandex.net.
	// In that case, provided host is used for all requests and proxy discovery is disabled.
	Proxy string

	// RPCProxy pins address of YT RPC proxy.
	//
	// If set, proxy discovery is disabled and provided value is used for all requests.
	//
	// If left empty, RPC proxies are discovered via HTTP using Proxy setting.
	//
	// Only relevant for RPC client.
	RPCProxy string

	// ProxyRole configures desired proxy role used by the client.
	//
	// If not set, default role is used.
	ProxyRole string

	// UseTLS enables TLS for all connections to cluster.
	//
	// This option is supported only in HTTP client.
	//
	// By default, client will not use TLS.
	//
	// TLS is not supported in local mode.
	UseTLS bool

	// CertificateAuthorityData contains PEM-encoded certificate authority certificates.
	//
	// Client appends this certificates to the system cert pool.
	//
	// This option is relevant for HTTP client with enabled TLS.
	CertificateAuthorityData []byte

	// Token configures OAuth token used by the client.
	//
	// If Token is not set, value of YT_TOKEN environment variable is used instead.
	Token string

	// ReadTokenFromFile
	//
	// When this variable is set, client tries reading token from ~/.yt/token file.
	ReadTokenFromFile bool

	// Credentials can be used for authentication.
	//
	// If Credentials are not set, OAuth token is used.
	Credentials Credentials

	// TVMFn is used to issue service tickets for YT API requests.
	//
	// TVM is a preferred way of service authentication.
	//
	// If TVMFn is not set, Credentials or OAuth token are used.
	//
	// Assign yttvm.TVMFn(tvm.Client) to this field, if you wish to enable tvm authentication.
	TVMFn TVMFn

	// UseTVMOnlyEndpoint configures client to use tvm-only endpoints in cluster connection.
	UseTVMOnlyEndpoint bool

	// DisableProxyDiscovery configures whether proxy discovery is enabled.
	//
	// Typically proxy discovery should be enabled, but in case if there is no
	// network connectivity from the client to the proxy instances and balancer
	// is used instead, proxy discovery should be disabled.
	DisableProxyDiscovery bool

	// Logger overrides default logger, used by the client.
	//
	// When Logger is not set, logging behaviour is configured by YT_LOG_LEVEL environment variable.
	//
	// If YT_LOG_LEVEL is not set, no logging is performed. Otherwise logs are written to stderr,
	// with log level derived from value of YT_LOG_LEVEL variable.
	//
	// WARNING: Running YT client in production without debug logs is highly discouraged.
	Logger log.Structured

	// Tracer overrides default tracer, used by the client
	//
	// When Tracer is not set opentracing.GlobalTracer is used.
	//
	// If opentracing.GlobalTracer is not set, no tracing is performed.
	Tracer opentracing.Tracer

	// TraceFn extracts trace parent from request context.
	//
	// This function is extracted into config in order to avoid direct dependency on jaeger client.
	//
	// Assign ytjaeger.TraceFn to this field, if you wish to enable tracing.
	TraceFn TraceFn

	// LightRequestTimeout specifies default timeout for light requests. Timeout includes all retries and backoffs.
	// Timeout for single request is not configurable right now.
	//
	// A Timeout of zero means no timeout (retries never stop).
	// Client can still specify timeout on per-request basis using context.
	//
	// nil value means default timeout of 5 minutes.
	LightRequestTimeout *time.Duration

	// TxTimeout specifies timeout of YT transaction (both master and tablet).
	//
	// YT transaction is aborted by server after not receiving pings from client for TxTimeout seconds.
	//
	// TxTimeout of zero means default timeout of 15 seconds.
	TxTimeout time.Duration

	// TxPingPeriod specifies period of pings for YT transactions.
	//
	// TxPingPeriod of zero means default value of 3 seconds.
	TxPingPeriod time.Duration

	// AllowRequestsFromJob explicitly allows creating client inside YT job.
	//
	// WARNING: This option can be enabled ONLY after explicit approval from YT team. If you enable this option
	// without approval, your might be BANNED.
	//
	// If you need to read tables, or access cypress from YT job, use API provided by mapreduce package, or
	// redesign your application.
	//
	// Typical mapreduce operation can launch hundred of thousands concurrent jobs. If each job makes even a single request,
	// that could easily lead to master/proxy overload.
	AllowRequestsFromJob bool

	// CompressionCodec specifies codec used for compression of client requests and server responses.
	//
	// NOTE: this codec has nothing to do with codec used for storing table chunks.
	CompressionCodec ClientCompressionCodec
}

func (*Config) GetClientCompressionCodec

func (c *Config) GetClientCompressionCodec() ClientCompressionCodec

func (*Config) GetLightRequestTimeout

func (c *Config) GetLightRequestTimeout() time.Duration

func (*Config) GetLogger

func (c *Config) GetLogger() log.Structured

func (*Config) GetProxy

func (c *Config) GetProxy() (string, error)

func (*Config) GetToken

func (c *Config) GetToken() string

func (*Config) GetTracer

func (c *Config) GetTracer() opentracing.Tracer

func (*Config) GetTxPingPeriod

func (c *Config) GetTxPingPeriod() time.Duration

func (*Config) GetTxTimeout

func (c *Config) GetTxTimeout() time.Duration

type CookieCredentials added in v0.0.14

type CookieCredentials struct {
	Cookie    *http.Cookie
	CSRFToken string
}

func (CookieCredentials) Set added in v0.0.14

func (c CookieCredentials) Set(r *http.Request)

func (CookieCredentials) SetExtension added in v0.0.14

func (c CookieCredentials) SetExtension(req *rpc.TRequestHeader)

type CopyNodeOptions

type CopyNodeOptions struct {
	Recursive      bool `http:"recursive"`
	IgnoreExisting bool `http:"ignore_existing"`
	Force          bool `http:"force"`

	PreserveAccount           *bool `http:"preserve_account,omitnil"`
	PreserveExpirationTime    *bool `http:"preserve_expiration_time,omitnil"`
	PreserveExpirationTimeout *bool `http:"preserve_expiration_timeout,omitnil"`
	PreserveCreationTime      *bool `http:"preserve_creation_time,omitnil"`
	PessimisticQuotaCheck     *bool `http:"pessimistic_quota_check,omitnil"`

	*TransactionOptions
	// *AccessTrackingOptions
	*MutatingOptions
	*PrerequisiteOptions
}

type CreateNodeOptions

type CreateNodeOptions struct {
	Recursive      bool `http:"recursive"`
	IgnoreExisting bool `http:"ignore_existing"`
	Force          bool `http:"force"`

	Attributes map[string]any `http:"attributes,omitnil"`

	*TransactionOptions
	*AccessTrackingOptions
	*MutatingOptions
	*PrerequisiteOptions
}

CreateNodeOptions.

See https://wiki.yandex-team.ru/yt/userdoc/api/#create

type CreateObjectOptions

type CreateObjectOptions struct {
	Recursive      bool `http:"recursive"`
	IgnoreExisting bool `http:"ignore_existing"`
	Force          bool `http:"force"`

	Attributes map[string]any `http:"attributes,omitnil"`

	*PrerequisiteOptions
	*AccessTrackingOptions
	*MutatingOptions
}

type CreateTableBackupOptions added in v0.0.10

type CreateTableBackupOptions struct {
	CheckpointTimestampDelay *yson.Duration `http:"checkpoint_timestamp_delay,omitnil"`
	CheckpointCheckPeriod    *yson.Duration `http:"checkpoint_check_period,omitnil"`
	CheckpointCheckTimeout   *yson.Duration `http:"checkpoint_check_timeout,omitnil"`

	Force bool `http:"force"`

	*TimeoutOptions
}

type CreateTableOption

type CreateTableOption func(options *CreateNodeOptions)

func WithAttributes

func WithAttributes(attrs map[string]any) CreateTableOption

func WithForce

func WithForce() CreateTableOption

func WithIgnoreExisting added in v0.0.6

func WithIgnoreExisting() CreateTableOption

func WithInferredSchema

func WithInferredSchema(row any) CreateTableOption

func WithRecursive

func WithRecursive() CreateTableOption

func WithSchema

func WithSchema(schema schema.Schema) CreateTableOption

type Credentials

type Credentials interface {
	Set(r *http.Request)
	SetExtension(req *rpc.TRequestHeader)
}

func ContextCredentials

func ContextCredentials(ctx context.Context) Credentials

type CypressClient

type CypressClient interface {
	// http:verb:"create"
	// http:params:"path","type"
	CreateNode(
		ctx context.Context,
		path ypath.YPath,
		typ NodeType,
		options *CreateNodeOptions,
	) (id NodeID, err error)

	// http:verb:"create"
	// http:params:"type"
	CreateObject(
		ctx context.Context,
		typ NodeType,
		options *CreateObjectOptions,
	) (id NodeID, err error)

	// http:verb:"exists"
	// http:params:"path"
	NodeExists(
		ctx context.Context,
		path ypath.YPath,
		options *NodeExistsOptions,
	) (ok bool, err error)

	// http:verb:"remove"
	// http:params:"path"
	RemoveNode(
		ctx context.Context,
		path ypath.YPath,
		options *RemoveNodeOptions,
	) (err error)

	// http:verb:"get"
	// http:params:"path"
	// http:extra
	GetNode(
		ctx context.Context,
		path ypath.YPath,
		result any,
		options *GetNodeOptions,
	) (err error)

	// http:verb:"set"
	// http:params:"path"
	// http:extra
	SetNode(
		ctx context.Context,
		path ypath.YPath,
		value any,
		options *SetNodeOptions,
	) (err error)

	// http:verb:"multiset_attributes"
	// http:params:"path"
	// http:extra
	MultisetAttributes(
		ctx context.Context,
		path ypath.YPath,
		attributes map[string]any,
		options *MultisetAttributesOptions,
	) (err error)

	// http:verb:"list"
	// http:params:"path"
	// http:extra
	ListNode(
		ctx context.Context,
		path ypath.YPath,
		result any,
		options *ListNodeOptions,
	) (err error)

	// http:verb:"copy"
	// http:params:"source_path","destination_path"
	CopyNode(
		ctx context.Context,
		src ypath.YPath,
		dst ypath.YPath,
		options *CopyNodeOptions,
	) (id NodeID, err error)

	// http:verb:"move"
	// http:params:"source_path","destination_path"
	MoveNode(
		ctx context.Context,
		src ypath.YPath,
		dst ypath.YPath,
		options *MoveNodeOptions,
	) (id NodeID, err error)

	// http:verb:"link"
	// http:params:"target_path","link_path"
	LinkNode(
		ctx context.Context,
		target ypath.YPath,
		link ypath.YPath,
		options *LinkNodeOptions,
	) (id NodeID, err error)
}

type DataStatistics added in v0.0.10

type DataStatistics struct {
	UncompressedDataSize int64 `yson:"uncompressed_data_size"`
	CompressedDataSize   int64 `yson:"compressed_data_size"`
	RowCount             int64 `yson:"row_count"`
	ChunkCount           int64 `yson:"chunk_count"`
	RegularDiskSpace     int64 `yson:"regular_disk_space"`
	ErasureDiskSpace     int64 `yson:"erasure_disk_space"`

	// For backward compatibility this can be -1 which means "invalid value".
	DataWeight int64 `yson:"data_weight"`

	UnmergedRowCount   int64 `yson:"unmerged_row_count"`
	UnmergedDataWeight int64 `yson:"unmerged_data_weight"`
}

type DeleteRowsOptions

type DeleteRowsOptions struct {
	RequireSyncReplica *bool `http:"require_sync_replica,omitnil"`

	*TransactionOptions
}

type DestroyChunkLocationsOptions added in v0.0.6

type DestroyChunkLocationsOptions struct {
}

type DestroyChunkLocationsResponse added in v0.0.3

type DestroyChunkLocationsResponse struct {
	LocationUUIDs []guid.GUID
}

type DisableChunkLocationsOptions added in v0.0.6

type DisableChunkLocationsOptions struct {
}

type DisableChunkLocationsResponse added in v0.0.3

type DisableChunkLocationsResponse struct {
	LocationUUIDs []guid.GUID
}

type Discoverer added in v0.0.10

type Discoverer interface {
	ListDiscoveryServers() ([]string, error)
	Stop()
}

type DiscoveryClient added in v0.0.10

type DiscoveryClient interface {
	// http:verb:"list_members"
	// http:params:"group_id"
	ListMembers(
		ctx context.Context,
		groupID string,
		options *ListMembersOptions,
	) (members []*MemberInfo, err error)

	// http:verb:"list_groups"
	// http:params:"prefix"
	ListGroups(
		ctx context.Context,
		prefix string,
		options *ListGroupsOptions,
	) (result *ListGroupsResponse, err error)

	// http:verb:"get_group_meta"
	// http:params:"group_id"
	GetGroupMeta(
		ctx context.Context,
		groupID string,
		options *GetGroupMetaOptions,
	) (meta *GroupMeta, err error)

	// http:verb:"heartbeat"
	// http:params:"group_id","member_info","lease_timeout"
	Heartbeat(
		ctx context.Context,
		groupID string,
		memberInfo MemberInfo,
		leaseTimeout int64,
		opts *HeartbeatOptions,
	) (err error)

	// Stop() cancels and waits for completion of all background activity associated with this client.
	Stop()
}

type DiscoveryConfig added in v0.0.10

type DiscoveryConfig struct {
	// DiscoveryServers is list of servers on which discovery client can send requests.
	DiscoveryServers []string

	// EndpointSet is id of endpoint set of discovery servers.
	//
	// If this field is set, then YPClusters must be set too.
	EndpointSet string

	// YPClusters is list of yp clusters where discovery servers are located.
	YPClusters []string

	// Token configures OAuth token used by the client.
	//
	// If Token is not set, value of YT_TOKEN environment variable is used instead.
	Token string

	// RequestTimeout specifies default timeout for requests. Timeout includes all retries and backoffs.
	// Timeout for single request is not configurable right now.
	//
	// A Timeout of zero means no timeout. Client can still specify timeout on per-request basis using context.
	//
	// nil value means default timeout of 5 minutes.
	RequestTimeout *time.Duration

	// Logger overrides default logger, used by the client.
	//
	// When Logger is not set, logging behaviour is configured by YT_LOG_LEVEL environment variable.
	//
	// If YT_LOG_LEVEL is not set, no logging is performed. Otherwise logs are written to stderr,
	// with log level derived from value of YT_LOG_LEVEL variable.
	//
	// WARNING: Running YT client in production without debug logs is highly discouraged.
	Logger log.Structured

	// AllowRequestsFromJob explicitly allows creating client inside YT job.
	//
	// WARNING: This option can be enabled ONLY after explicit approval from YT team. If you enable this option
	// without approval, your might be BANNED.
	//
	// If you need to read tables, or access cypress from YT job, use API provided by mapreduce package, or
	// redesign your application.
	//
	// Typical mapreduce operation can launch hundred of thousands concurrent jobs. If each job makes even a single request,
	// that could easily lead to master/proxy overload.
	AllowRequestsFromJob bool
}

func (*DiscoveryConfig) GetLogger added in v0.0.10

func (c *DiscoveryConfig) GetLogger() log.Structured

func (*DiscoveryConfig) GetRequestTimeout added in v0.0.10

func (c *DiscoveryConfig) GetRequestTimeout() time.Duration

func (*DiscoveryConfig) GetToken added in v0.0.10

func (c *DiscoveryConfig) GetToken() string

type ExecTabletTxOptions

type ExecTabletTxOptions struct {
	RetryOptions ExecTxRetryOptions
	*StartTabletTxOptions
}

type ExecTxOptions

type ExecTxOptions struct {
	RetryOptions ExecTxRetryOptions
	*StartTxOptions
}

type ExecTxRetryOptions

type ExecTxRetryOptions backoff.BackOff

type ExecTxRetryOptionsNone

type ExecTxRetryOptionsNone = backoff.StopBackOff

ExecTxRetryOptionsNone is a fixed retry policy that never retries the operation.

type FileClient

type FileClient interface {
	// http:verb:"write_file"
	// http:params:"path"
	WriteFile(
		ctx context.Context,
		path ypath.YPath,
		options *WriteFileOptions,
	) (w io.WriteCloser, err error)

	// http:verb:"read_file"
	// http:params:"path"
	ReadFile(
		ctx context.Context,
		path ypath.YPath,
		options *ReadFileOptions,
	) (r io.ReadCloser, err error)

	// http:verb:"put_file_to_cache"
	// http:params:"path","md5"
	PutFileToCache(
		ctx context.Context,
		path ypath.YPath,
		md5 string,
		options *PutFileToCacheOptions,
	) (cachedPath ypath.YPath, err error)

	// http:verb:"get_file_from_cache"
	// http:params:"md5"
	GetFileFromCache(
		ctx context.Context,
		md5 string,
		options *GetFileFromCacheOptions,
	) (path ypath.YPath, err error)
}

type FreezeTableOptions

type FreezeTableOptions struct {
	*TabletRangeOptions
	*MutatingOptions
}

type GenerateTimestampOptions

type GenerateTimestampOptions struct{}

type GetFileFromCacheOptions

type GetFileFromCacheOptions struct {
	CachePath ypath.YPath `http:"cache_path"`

	*MasterReadOptions
	*ReadRetryOptions
}

type GetGroupMetaOptions added in v0.0.10

type GetGroupMetaOptions struct {
}

type GetInSyncReplicasOptions

type GetInSyncReplicasOptions struct{}

type GetJobStderrOptions

type GetJobStderrOptions struct {
}

type GetNodeOptions

type GetNodeOptions struct {
	Attributes []string `http:"attributes,omitnil"`
	MaxSize    *int64   `http:"max_size,omitnil"`

	*TransactionOptions
	*AccessTrackingOptions
	*PrerequisiteOptions
	*MasterReadOptions

	*ReadRetryOptions
}

type GetOperationOptions

type GetOperationOptions struct {
	Attributes     []string `http:"attributes,omitnil"`
	IncludeRuntime *bool    `http:"include_runtime,omitnil"`

	*MasterReadOptions

	*ReadRetryOptions
}

type GetQueryOptions added in v0.0.10

type GetQueryOptions struct {
	Attributes []string `http:"attributes,omitnil"`
	Timestamp  *uint64  `http:"timestamp,omitnil"`

	*QueryTrackerOptions
}

type GetQueryResultOptions added in v0.0.10

type GetQueryResultOptions struct {
	*QueryTrackerOptions
}

type GroupMeta added in v0.0.10

type GroupMeta struct {
	MemberCount int32
}

type HeartbeatOptions added in v0.0.10

type HeartbeatOptions struct {
}

type InsertRowsOptions

type InsertRowsOptions struct {
	Atomicity          *Atomicity `http:"atomicity,omitnil"`
	RequireSyncReplica *bool      `http:"require_sync_replica,omitnil"`
	Update             *bool      `http:"update,omitnil"`

	*TransactionOptions
}

type IssueTokenOptions added in v0.0.17

type IssueTokenOptions struct{}

type JobDataSource

type JobDataSource string
var (
	JobDataSourceArchive JobDataSource = "archive"
	JobDataSourceRuntime JobDataSource = "runtime"
	JobDataSourceAuto    JobDataSource = "auto"
	JobDataSourceManual  JobDataSource = "manual"
)

type JobExecAttributes

type JobExecAttributes struct {
	MediumName  string   `yson:"medium_name"`
	IPAddresses []string `yson:"ip_addresses"`
	SandboxPath string   `yson:"sandbox_path"`
	SlotIndex   int      `yson:"slot_index"`
}

type JobID

type JobID guid.GUID

func (JobID) MarshalYSON

func (id JobID) MarshalYSON(w *yson.Writer) error

func (JobID) String

func (id JobID) String() string

func (*JobID) UnmarshalYSON

func (id *JobID) UnmarshalYSON(data []byte) (err error)

type JobSortField

type JobSortField string
var (
	SortFieldNone       JobSortField = "none"
	SortFieldType       JobSortField = "type"
	SortFieldState      JobSortField = "state"
	SortFieldStartTime  JobSortField = "start_time"
	SortFieldFinishTime JobSortField = "finish_time"
	SortFieldAddress    JobSortField = "address"
	SortFieldDuration   JobSortField = "duration"
	SortFieldProgress   JobSortField = "progress"
	SortFieldID         JobSortField = "id"
)

type JobSortOrder

type JobSortOrder string
var (
	Ascending  JobSortOrder = "ascending"
	Descending JobSortOrder = "descending"
)

type JobState

type JobState string
var (
	JobRunning   JobState = "running"
	JobWaiting   JobState = "waiting"
	JobCompleted JobState = "completed"
	JobFailed    JobState = "failed"
	JobAborted   JobState = "aborted"
)

type JobStatus

type JobStatus struct {
	ID              JobID              `yson:"id"`
	Type            string             `yson:"type"`
	State           string             `yson:"state"`
	Address         string             `yson:"address"`
	StartTime       yson.Time          `yson:"start_time"`
	FinishTime      yson.Time          `yson:"finish_time,omitempty"`
	FailContextSize int                `yson:"fail_context_size,omitempty"`
	Error           yterrors.Error     `yson:"error,omitempty"`
	Progress        float64            `yson:"progress,omitempty"`
	ExecAttributes  *JobExecAttributes `yson:"exec_attributes,omitempty"`
}

func ListAllJobs

func ListAllJobs(ctx context.Context, yc Client, opID OperationID, opts *ListJobsOptions) ([]JobStatus, error)

ListAllJobs lists operation jobs with pagination.

Depending on the filters used the result might be quite big. Consider using RangeOperations to limit memory consumption.

type JobType

type JobType string
var (
	JobTypeMap              JobType = "map"
	JobTypePartitionMap     JobType = "partition_map"
	JobTypeSortedMerge      JobType = "sorted_merge"
	JobTypeOrderedMerge     JobType = "ordered_merge"
	JobTypeUnorderedMerge   JobType = "unordered_merge"
	JobTypePartition        JobType = "partition"
	JobTypeSimpleSort       JobType = "simple_sort"
	JobTypeFinalSort        JobType = "final_sort"
	JobTypeSortedReduce     JobType = "sorted_reduce"
	JobTypePartitionReduce  JobType = "partition_reduce"
	JobTypeReduceCombiner   JobType = "reduce_combiner"
	JobTypeRemoteCopy       JobType = "remote_copy"
	JobTypeIntermediateSort JobType = "intermediate_sort"
	JobTypeOrderedMap       JobType = "ordered_map"
	JobTypeJoinReduce       JobType = "join_reduce"
	JobTypeVanilla          JobType = "vanilla"
	JobTypeSchedulerUnknown JobType = "scheduler_unknown"
)

type LinkNodeOptions

type LinkNodeOptions struct {
	Recursive      bool `http:"recursive"`
	IgnoreExisting bool `http:"ignore_existing"`
	Force          bool `http:"force"`

	Attributes map[string]any `http:"attributes,omitnil"`

	*TransactionOptions
	// *AccessTrackingOptions
	*MutatingOptions
	*PrerequisiteOptions
}

type ListGroupsOptions added in v0.0.13

type ListGroupsOptions struct {
	Limit *int32
}

type ListGroupsResponse added in v0.0.13

type ListGroupsResponse struct {
	GroupIDs   []string
	Incomplete bool
}

type ListJobsOptions

type ListJobsOptions struct {
	JobType                  *JobType       `http:"job_type,omitnil"`
	JobState                 *JobState      `http:"job_state,omitnil"`
	Address                  *string        `http:"address,omitnil"`
	WithStderr               *bool          `http:"with_stderr,omitnil"`
	WithFailContext          *bool          `http:"with_fail_context,omitnil"`
	WithMonitoringDescriptor *bool          `http:"with_monitoring_descriptor,omitnil"`
	SortField                *JobSortField  `http:"sort_field,omitnil"`
	SortOrder                *JobSortOrder  `http:"sort_order,omitnil"`
	Limit                    *int           `http:"limit,omitnil"`
	Offset                   *int           `http:"offset,omitnil"`
	DataSource               *JobDataSource `http:"data_source,omitnil"`
}

type ListJobsResult

type ListJobsResult struct {
	Jobs []JobStatus `yson:"jobs"`
}

type ListMembersOptions added in v0.0.10

type ListMembersOptions struct {
	Limit         *int32
	AttributeKeys []string
}

type ListNodeOptions

type ListNodeOptions struct {
	Attributes []string `http:"attributes,omitnil"`
	MaxSize    *int64   `http:"max_size,omitnil"`

	*TransactionOptions
	*MasterReadOptions
	*AccessTrackingOptions
	*PrerequisiteOptions

	*ReadRetryOptions
}

type ListOperationsOptions

type ListOperationsOptions struct {
	*MasterReadOptions

	*ReadRetryOptions

	FromTime *yson.Time      `http:"from_time,omitnil"`
	ToTime   *yson.Time      `http:"to_time,omitnil"`
	Cursor   *yson.Time      `http:"cursor_time,omitnil"`
	User     *string         `http:"user,omitnil"`
	State    *OperationState `http:"state,omitnil"`
	Type     *OperationType  `http:"type,omitnil"`
	Filter   *string         `http:"filter,omitnil"`
	Limit    *int            `http:"limit,omitnil"`
}

type ListOperationsResult

type ListOperationsResult struct {
	Operations      []OperationStatus `yson:"operations"`
	Incomplete      bool              `yson:"incomplete"`
	PoolCounts      map[string]int    `yson:"pool_counts"`
	UserCounts      map[string]int    `yson:"user_counts"`
	StateCounts     map[string]int    `yson:"state_counts"`
	TypeCounts      map[string]int    `yson:"type_counts"`
	FailedJobsCount int               `yson:"failed_jobs_count"`
}

type ListQueriesOptions added in v0.0.10

type ListQueriesOptions struct {
	FromTime        *yson.Time              `http:"from_time,omitnil"`
	ToTime          *yson.Time              `http:"to_time,omitnil"`
	CursorTime      *yson.Time              `http:"cursor_time,omitnil"`
	CursorDirection *OperationSortDirection `http:"cursor_direction,omitnil"`
	UserFilter      *string                 `http:"user_filter,omitnil"`

	StateFilter  *QueryState  `http:"state_filter,omitnil"`
	EngineFilter *QueryEngine `http:"engine_filter,omitnil"`
	SubstrFilter *string      `http:"substr_filter,omitnil"`
	Limit        *int64       `http:"limit,omitnil"`

	Attributes []string `http:"attributes,omitnil"`

	*QueryTrackerOptions
}

type ListQueriesResult added in v0.0.10

type ListQueriesResult struct {
	Queries    []Query `yson:"queries"`
	Incomplete bool    `yson:"incomplete"`
	Timestamp  uint64  `yson:"timestamp"`
}

type ListUserTokensOptions added in v0.0.17

type ListUserTokensOptions struct{}

type LocateSkynetShareOptions

type LocateSkynetShareOptions struct{}

type LockClient

type LockClient interface {
	// http:verb:"lock"
	// http:params:"path","mode"
	LockNode(
		ctx context.Context,
		path ypath.YPath,
		mode LockMode,
		options *LockNodeOptions,
	) (res LockResult, err error)

	// http:verb:"unlock"
	// http:params:"path"
	UnlockNode(
		ctx context.Context,
		path ypath.YPath,
		options *UnlockNodeOptions,
	) (err error)
}

type LockMode

type LockMode string
const (
	LockSnapshot  LockMode = "snapshot"
	LockShared    LockMode = "shared"
	LockExclusive LockMode = "exclusive"
)

type LockNodeOptions

type LockNodeOptions struct {
	Waitable     bool    `http:"waitable"`
	ChildKey     *string `http:"child_key,omitnil"`
	AttributeKey *string `http:"attribute_key,omitnil"`

	*TransactionOptions
	*MutatingOptions
}

type LockResult

type LockResult struct {
	NodeID NodeID    `yson:"node_id"`
	LockID guid.GUID `yson:"lock_id"`
}

type LockRowsOptions

type LockRowsOptions struct {
	*TransactionOptions
}

type LockState

type LockState string

LockState type holds available lock states.

const (
	// LockPending is a state of a queued waitable lock.
	LockPending LockState = "pending"
	// LockAcquired is a state of an acquired lock.
	LockAcquired LockState = "acquired"
)

type LockType

type LockType string
const (
	LockTypeNone         LockType = "none"
	LockTypeSharedWeak   LockType = "shared_weak"
	LockTypeSharedStrong LockType = "shared_strong"
	LockTypeExclusive    LockType = "exclusive"
)

type LookupRowsOptions

type LookupRowsOptions struct {
	// KeepMissingRows changes handling of missing rows.
	//
	// When this flag is not set, missing rows are skipped.
	// When flag is set, nil values are returned for missing rows.
	KeepMissingRows bool `http:"keep_missing_rows"`

	// Timestamp overrides timestamp for lookup.
	//
	// By default, lookup returns data from the point in time when
	// transaction was started.
	Timestamp *Timestamp `http:"timestamp,omitnil"`

	// Columns filters columns in lookup result.
	Columns []string `http:"column_names,omitnil"`

	*TransactionOptions
}

type LowLevelSchedulerClient

type LowLevelSchedulerClient interface {
	OperationStartClient

	// http:verb:"abort_operation"
	// http:params:"operation_id"
	AbortOperation(
		ctx context.Context,
		opID OperationID,
		options *AbortOperationOptions,
	) (err error)

	// http:verb:"suspend_operation"
	// http:params:"operation_id"
	SuspendOperation(
		ctx context.Context,
		opID OperationID,
		options *SuspendOperationOptions,
	) (err error)

	// http:verb:"resume_operation"
	// http:params:"operation_id"
	ResumeOperation(
		ctx context.Context,
		opID OperationID,
		options *ResumeOperationOptions,
	) (err error)

	// http:verb:"complete_operation"
	// http:params:"operation_id"
	CompleteOperation(
		ctx context.Context,
		opID OperationID,
		options *CompleteOperationOptions,
	) (err error)

	// http:verb:"update_operation_parameters"
	// http:params:"operation_id","parameters"
	UpdateOperationParameters(
		ctx context.Context,
		opID OperationID,
		params any,
		options *UpdateOperationParametersOptions,
	) (err error)

	// http:verb:"get_operation"
	// http:params:"operation_id"
	GetOperation(
		ctx context.Context,
		opID OperationID,
		options *GetOperationOptions,
	) (status *OperationStatus, err error)

	// http:verb:"get_operation"
	// http:params:"operation_alias"
	GetOperationByAlias(
		ctx context.Context,
		alias string,
		options *GetOperationOptions,
	) (status *OperationStatus, err error)

	// http:verb:"list_operations"
	ListOperations(
		ctx context.Context,
		options *ListOperationsOptions,
	) (operations *ListOperationsResult, err error)

	// http:verb:"list_jobs"
	// http:params:"operation_id"
	ListJobs(
		ctx context.Context,
		opID OperationID,
		options *ListJobsOptions,
	) (r *ListJobsResult, err error)

	// http:verb:"get_job_stderr"
	// http:params:"operation_id","job_id"
	GetJobStderr(
		ctx context.Context,
		opID OperationID,
		jobID JobID,
		options *GetJobStderrOptions,
	) (r []byte, err error)
}

LowLevelSchedulerClient is stateless interface to the YT scheduler.

Clients should use package mapreduce instead.

type LowLevelTxClient

type LowLevelTxClient interface {
	// http:verb:"start_transaction"
	StartTx(
		ctx context.Context,
		options *StartTxOptions,
	) (id TxID, err error)

	// http:verb:"start_transaction"
	StartTabletTx(
		ctx context.Context,
		options *StartTabletTxOptions,
	) (id TxID, err error)

	// http:verb:"ping_transaction"
	// http:params:"transaction_id"
	PingTx(
		ctx context.Context,
		id TxID,
		options *PingTxOptions,
	) (err error)

	// http:verb:"abort_transaction"
	// http:params:"transaction_id"
	AbortTx(
		ctx context.Context,
		id TxID,
		options *AbortTxOptions,
	) (err error)

	// http:verb:"commit_transaction"
	// http:params:"transaction_id"
	CommitTx(
		ctx context.Context,
		id TxID,
		options *CommitTxOptions,
	) (err error)
}

LowLevelTxClient provides stateless interface to YT transactions.

Clients should rarely use it directly.

type MaintenanceComponent added in v0.0.7

type MaintenanceComponent string
const (
	MaintenanceComponentClusterNode MaintenanceComponent = "cluster_node"
	MaintenanceComponentHTTPProxy   MaintenanceComponent = "http_proxy"
	MaintenanceComponentRPCProxy    MaintenanceComponent = "rpc_proxy"
	MaintenanceComponentHost        MaintenanceComponent = "host"
)

type MaintenanceID added in v0.0.7

type MaintenanceID guid.GUID

func (MaintenanceID) MarshalYSON added in v0.0.7

func (id MaintenanceID) MarshalYSON(w *yson.Writer) error

func (MaintenanceID) String added in v0.0.7

func (id MaintenanceID) String() string

func (*MaintenanceID) UnmarshalYSON added in v0.0.7

func (id *MaintenanceID) UnmarshalYSON(data []byte) (err error)

type MaintenanceType added in v0.0.7

type MaintenanceType string
const (
	MaintenanceTypeBan                  MaintenanceType = "ban"
	MaintenanceTypeDecommission         MaintenanceType = "decommission"
	MaintenanceTypeDisableSchedulerJobs MaintenanceType = "disable_scheduler_jobs"
	MaintenanceTypeDisableWriteSessions MaintenanceType = "disable_write_sessions"
	MaintenanceTypeDisableTabletCells   MaintenanceType = "disable_tablet_cells"
	MaintenanceTypePendingRestart       MaintenanceType = "pending_restart"
)

type MasterReadOptions

type MasterReadOptions struct {
	ReadFrom                        ReadKind       `http:"read_from"`
	DisablePerUserCache             *bool          `http:"disable_per_user_cache,omitnil"`
	ExpireAfterSuccessfulUpdateTime *yson.Duration `http:"expire_after_successful_update_time,omitnil"`
	ExpireAfterFailedUpdateTime     *yson.Duration `http:"expire_after_failed_update_time,omitnil"`
	CacheStickyGroupSize            *int32         `http:"cache_sticky_group_size,omitnil"`
	SuccessStalenessBound           *yson.Duration `http:"success_staleness_bound,omitnil"`
}

MasterReadOptions specify where cypress read requests are routed.

By default read requests are served from followers.

type MemberInfo added in v0.0.10

type MemberInfo struct {
	ID         string
	Priority   int64
	Revision   int64
	Attributes []*Attribute
}

type MountClient

type MountClient interface {
	// http:verb:"mount_table"
	// http:params:"path"
	MountTable(
		ctx context.Context,
		path ypath.Path,
		options *MountTableOptions,
	) (err error)

	// http:verb:"unmount_table"
	// http:params:"path"
	UnmountTable(
		ctx context.Context,
		path ypath.Path,
		options *UnmountTableOptions,
	) (err error)

	// http:verb:"remount_table"
	// http:params:"path"
	RemountTable(
		ctx context.Context,
		path ypath.Path,
		options *RemountTableOptions,
	) (err error)

	// http:verb:"reshard_table"
	// http:params:"path"
	ReshardTable(
		ctx context.Context,
		path ypath.Path,
		options *ReshardTableOptions,
	) (err error)

	// http:verb:"alter_table"
	// http:params:"path"
	AlterTable(
		ctx context.Context,
		path ypath.Path,
		options *AlterTableOptions,
	) (err error)

	// http:verb:"freeze_table"
	// http:params:"path"
	FreezeTable(
		ctx context.Context,
		path ypath.Path,
		options *FreezeTableOptions,
	) (err error)

	// http:verb:"unfreeze_table"
	// http:params:"path"
	UnfreezeTable(
		ctx context.Context,
		path ypath.Path,
		options *UnfreezeTableOptions,
	) (err error)

	// http:verb:"alter_table_replica"
	// http:params:"replica_id"
	AlterTableReplica(
		ctx context.Context,
		id NodeID,
		options *AlterTableReplicaOptions,
	) (err error)
}

type MountTableOptions

type MountTableOptions struct {
	*TabletRangeOptions
	*MutatingOptions

	CellID        *guid.GUID  `http:"cell_id,omitnil"`
	TargetCellIDs []guid.GUID `http:"target_cell_ids,omitnil"`
	Freeze        bool        `http:"freeze"`
}

type MoveNodeOptions

type MoveNodeOptions struct {
	Recursive bool `http:"recursive"`
	Force     bool `http:"force"`

	PreserveAccount           *bool `http:"preserve_account,omitnil"`
	PreserveExpirationTime    *bool `http:"preserve_expiration_time,omitnil"`
	PreserveExpirationTimeout *bool `http:"preserve_expiration_timeout,omitnil"`
	PessimisticQuotaCheck     *bool `http:"pessimistic_quota_check,omitnil"`

	*TransactionOptions
	// *AccessTrackingOptions
	*MutatingOptions
	*PrerequisiteOptions
}

type MutatingOptions

type MutatingOptions struct {
	MutationID MutationID `http:"mutation_id"`
	Retry      bool       `http:"retry"`
}

MutatingOptions enable safe retries of cypress commands in the presence of network errors.

If MutatingOptions are missing, MutationID will be generated by the library. Otherwise, the passed MutationID will be used for the first request and retries.

The passed Retry value will be used for the first request, and then Retry will be true for retries.

type MutationID

type MutationID guid.GUID

func (MutationID) MarshalYSON

func (id MutationID) MarshalYSON(w *yson.Writer) error

func (MutationID) String

func (id MutationID) String() string

func (*MutationID) UnmarshalYSON

func (id *MutationID) UnmarshalYSON(data []byte) (err error)

type NodeAddress

type NodeAddress struct {
	NodeID    uint              `yson:"node_id"`
	Addresses map[string]string `yson:"addresses"`
}

type NodeID

type NodeID guid.GUID

func CreateTable

func CreateTable(ctx context.Context, yc CypressClient, path ypath.Path, opts ...CreateTableOption) (id NodeID, err error)

func (NodeID) MarshalText

func (id NodeID) MarshalText() ([]byte, error)

func (NodeID) MarshalYSON

func (id NodeID) MarshalYSON(w *yson.Writer) error

func (NodeID) String

func (id NodeID) String() string

func (*NodeID) UnmarshalText

func (id *NodeID) UnmarshalText(data []byte) (err error)

func (*NodeID) UnmarshalYSON

func (id *NodeID) UnmarshalYSON(data []byte) (err error)

func (NodeID) YPath

func (id NodeID) YPath() ypath.Path

type NodeType

type NodeType string
const (
	// NodeMap is cypress analog for directory.
	NodeMap NodeType = "map_node"
	// NodeLink is symbolic link.
	NodeLink NodeType = "link"
	// NodeFile is regular file. Used for artifacts and opaque blobs.
	NodeFile NodeType = "file"
	// NodeTable is table.
	NodeTable NodeType = "table"

	NodeString  NodeType = "string_node"
	NodeBoolean NodeType = "boolean_node"

	NodeDocument          NodeType = "document"
	NodeTableReplica      NodeType = "table_replica"
	NodeReplicatedTable   NodeType = "replicated_table"
	NodeUser              NodeType = "user"
	NodeGroup             NodeType = "group"
	NodeAccount           NodeType = "account"
	NodeDomesticMedium    NodeType = "domestic_medium"
	NodeTabletCellBundle  NodeType = "tablet_cell_bundle"
	NodeTabletCell        NodeType = "tablet_cell"
	NodeSys               NodeType = "sys_node"
	NodePortalEntrance    NodeType = "portal_entrance"
	NodePortalExit        NodeType = "portal_exit"
	NodeSchedulerPool     NodeType = "scheduler_pool"
	NodeSchedulerPoolTree NodeType = "scheduler_pool_tree"

	NodeAccessControlObject          NodeType = "access_control_object"
	NodeAccessControlObjectNamespace NodeType = "access_control_object_namespace"
)

func (NodeType) String

func (n NodeType) String() string

type OperationID

type OperationID guid.GUID

func (OperationID) MarshalText added in v0.0.10

func (id OperationID) MarshalText() ([]byte, error)

func (OperationID) MarshalYSON

func (id OperationID) MarshalYSON(w *yson.Writer) error

func (OperationID) String

func (id OperationID) String() string

func (*OperationID) UnmarshalText added in v0.0.10

func (id *OperationID) UnmarshalText(data []byte) error

func (*OperationID) UnmarshalYSON

func (id *OperationID) UnmarshalYSON(data []byte) (err error)

type OperationResult

type OperationResult struct {
	Error *yterrors.Error `yson:"error"`
}

type OperationRuntimeParameters

type OperationRuntimeParameters struct {
	ACL                          []ACE          `yson:"acl"`
	SchedulingOptionsPerPoolTree map[string]any `yson:"scheduling_options_per_pool_tree"`
	Annotations                  map[string]any `yson:"annotations"`
	ErasedTrees                  []string       `yson:"erased_trees"`
}

type OperationSortDirection added in v0.0.10

type OperationSortDirection string
const (
	SortDirectionNone   OperationSortDirection = "none"
	SortDirectionPast   OperationSortDirection = "past"
	SortDirectionFuture OperationSortDirection = "future"
)

type OperationStartClient

type OperationStartClient interface {
	// http:verb:"start_operation"
	// http:params:"operation_type","spec"
	StartOperation(
		ctx context.Context,
		opType OperationType,
		spec any,
		options *StartOperationOptions,
	) (opID OperationID, err error)
}

type OperationState

type OperationState string
var (
	StateRunning       OperationState = "running"
	StatePending       OperationState = "pending"
	StateCompleted     OperationState = "completed"
	StateFailed        OperationState = "failed"
	StateAborted       OperationState = "aborted"
	StateReviving      OperationState = "reviving"
	StateInitializing  OperationState = "initializing"
	StatePreparing     OperationState = "preparing"
	StateMaterializing OperationState = "materializing"
	StateCompleting    OperationState = "completing"
	StateAborting      OperationState = "aborting"
	StateFailing       OperationState = "failing"
)

func (OperationState) IsFinished

func (o OperationState) IsFinished() bool

type OperationStatus

type OperationStatus struct {
	ID                OperationID                `yson:"id"`
	State             OperationState             `yson:"state"`
	Result            *OperationResult           `yson:"result"`
	Type              OperationType              `yson:"type"`
	BriefSpec         map[string]any             `yson:"brief_spec"`
	FullSpec          yson.RawValue              `yson:"full_spec"`
	StartTime         yson.Time                  `yson:"start_time"`
	FinishTime        yson.Time                  `yson:"finish_time"`
	Suspend           bool                       `yson:"suspend"`
	AuthenticatedUser string                     `yson:"authenticated_user"`
	RuntimeParameters OperationRuntimeParameters `yson:"runtime_parameters"`
}

func ListAllOperations

func ListAllOperations(ctx context.Context, yc Client, opts *ListOperationsOptions) ([]OperationStatus, error)

ListAllOperations lists operations with pagination.

Depending on the filters used the result might be quite big. Consider using RangeOperations to limit memory consumption.

type OperationType

type OperationType string
var (
	OperationMap        OperationType = "map"
	OperationReduce     OperationType = "reduce"
	OperationMapReduce  OperationType = "map_reduce"
	OperationSort       OperationType = "sort"
	OperationMerge      OperationType = "merge"
	OperationErase      OperationType = "erase"
	OperationRemoteCopy OperationType = "remote_copy"
	OperationVanilla    OperationType = "vanilla"
)

type OrderedTableBackupMode added in v0.0.10

type OrderedTableBackupMode string
const (
	OrderedTableBackupModeExact   OrderedTableBackupMode = "exact"
	OrderedTableBackupModeAtLeast OrderedTableBackupMode = "at_least"
	OrderedTableBackupModeAtMost  OrderedTableBackupMode = "at_most"
)

type Permission

type Permission = string

TODO(dakovalkov): create a different type for Permission

const (
	PermissionRead                  Permission = "read"
	PermissionWrite                 Permission = "write"
	PermissionUse                   Permission = "use"
	PermissionAdminister            Permission = "administer"
	PermissionCreate                Permission = "create"
	PermissionRemove                Permission = "remove"
	PermissionMount                 Permission = "mount"
	PermissionManage                Permission = "manage"
	PermissionModifyChildren        Permission = "modify_children"
	PermissionRegisterQueueConsumer Permission = "register_queue_consumer"
)

type PingTxOptions

type PingTxOptions struct {
	*TransactionOptions
}

type PrerequisiteOptions

type PrerequisiteOptions struct {
	TransactionIDs []TxID                 `http:"prerequisite_transaction_ids,omitnil"`
	Revisions      []PrerequisiteRevision `http:"prerequisite_revisions,omitnil"`
}

type PrerequisiteRevision

type PrerequisiteRevision struct {
	Path          ypath.Path `yson:"path"`
	TransactionID TxID       `yson:"transaction_id"`
	Revision      Revision   `yson:"revision"`
}

type PutFileToCacheOptions

type PutFileToCacheOptions struct {
	CachePath ypath.YPath `http:"cache_path"`

	*MasterReadOptions
	*MutatingOptions
	*PrerequisiteOptions
}

type Query added in v0.0.10

type Query struct {
	ID              QueryID        `yson:"id"`
	Engine          *QueryEngine   `yson:"engine"`
	Query           *string        `yson:"query"`
	StartTime       *yson.Time     `yson:"start_time"`
	FinishTime      *yson.Time     `yson:"finish_time"`
	Settings        any            `yson:"settings"`
	User            *string        `yson:"user"`
	State           *QueryState    `yson:"state"`
	ResultCount     *int64         `yson:"result_count"`
	Progress        any            `yson:"progress"`
	Err             yterrors.Error `yson:"error"`
	Annotations     any            `yson:"annotations"`
	OtherAttributes any            `yson:"other_attributes"`
}

type QueryEngine added in v0.0.10

type QueryEngine string
const (
	QueryEngineQL   QueryEngine = "ql"
	QueryEngineYQL  QueryEngine = "yql"
	QueryEngineCHYT QueryEngine = "chyt"
	QueryEngineMock QueryEngine = "mock"
)

type QueryID added in v0.0.10

type QueryID guid.GUID

func (QueryID) MarshalYSON added in v0.0.10

func (id QueryID) MarshalYSON(w *yson.Writer) error

func (QueryID) String added in v0.0.10

func (id QueryID) String() string

func (*QueryID) UnmarshalYSON added in v0.0.10

func (id *QueryID) UnmarshalYSON(data []byte) (err error)

type QueryResult added in v0.0.10

type QueryResult struct {
	ID             QueryID          `yson:"id"`
	ResultIndex    int64            `yson:"result_index"`
	Err            yterrors.Error   `yson:"error"`
	Schema         []map[string]any `yson:"schema"`
	DataStatistics DataStatistics   `yson:"data_statistics"`
}

type QueryState added in v0.0.10

type QueryState string
const (
	QueryStateDraft      QueryState = "draft"
	QueryStatePending    QueryState = "pending"
	QueryStateRunning    QueryState = "running"
	QueryStateAborting   QueryState = "aborting"
	QueryStateAborted    QueryState = "aborted"
	QueryStateCompleting QueryState = "completing"
	QueryStateCompleted  QueryState = "completed"
	QueryStateFailing    QueryState = "failing"
	QueryStateFailed     QueryState = "failed"
)

type QueryTrackerClient added in v0.0.10

type QueryTrackerClient interface {
	// http:verb:"start_query"
	// http:params:"engine","query"
	StartQuery(
		ctx context.Context,
		engine QueryEngine,
		query string,
		options *StartQueryOptions,
	) (id QueryID, err error)

	// http:verb:"abort_query"
	// http:params:"query_id"
	AbortQuery(
		ctx context.Context,
		id QueryID,
		options *AbortQueryOptions,
	) (err error)

	// http:verb:"get_query"
	// http:params:"query_id"
	GetQuery(
		ctx context.Context,
		id QueryID,
		options *GetQueryOptions,
	) (query *Query, err error)

	// http:verb:"list_queries"
	ListQueries(
		ctx context.Context,
		options *ListQueriesOptions,
	) (result *ListQueriesResult, err error)

	// http:verb:"get_query_result"
	// http:params:"query_id","result_index"
	GetQueryResult(
		ctx context.Context,
		id QueryID,
		resultIndex int64,
		options *GetQueryResultOptions,
	) (result *QueryResult, err error)

	// http:verb:"read_query_result"
	// http:params:"query_id","result_index"
	ReadQueryResult(
		ctx context.Context,
		id QueryID,
		resultIndex int64,
		options *ReadQueryResultOptions,
	) (r TableReader, err error)

	// http:verb:"alter_query"
	// http:params:"query_id"
	AlterQuery(
		ctx context.Context,
		id QueryID,
		options *AlterQueryOptions,
	) (err error)
}

type QueryTrackerOptions added in v0.0.10

type QueryTrackerOptions struct {
	Stage *string `http:"stage,omitnil"`
}

type RangeJobsCallback

type RangeJobsCallback func(job JobStatus)

type RangeOperationsCallback

type RangeOperationsCallback func(op OperationStatus)

type ReadFileOptions

type ReadFileOptions struct {
	Offset     *int64 `http:"offset,omitnil"`
	Length     *int64 `http:"length,omitnil"`
	FileReader any    `http:"file_reader"`

	*TransactionOptions
	*AccessTrackingOptions
}

type ReadKind

type ReadKind string
const (
	ReadFromLeader      ReadKind = "leader"
	ReadFromFollower    ReadKind = "follower"
	ReadFromCache       ReadKind = "cache"
	ReadFromMasterCache ReadKind = "master_cache"
)

type ReadQueryResultOptions added in v0.0.10

type ReadQueryResultOptions struct {
	Columns       []string `http:"columns,omitnil"`
	LowerRowIndex *int64   `http:"lower_row_index,omitnil"`
	UpperRowIndex *int64   `http:"upper_row_index,omitnil"`

	*QueryTrackerOptions
}

type ReadRetryOptions

type ReadRetryOptions struct {
}

ReadRetryOptions is marker for distinguishing requests that might be safely retried.

TODO(prime@): rename to SafeRetryOptions

type ReadTableOptions

type ReadTableOptions struct {
	Unordered   bool `http:"unordered"`
	TableReader any  `http:"table_reader"`

	ControlAttributes any   `http:"control_attributes,omitnil"`
	StartRowIndexOnly *bool `http:"start_row_index_only,omitnil"`

	// Smart flag enables client side retries.
	//
	// When used outside of transaction, ReadTable automatically creates new transaction and
	// acquires table snapshot lock.
	//
	// When used inside of transaction, ReadTable does not create any additional transactions.
	//
	// Internal retries continue indefinitely. User must set appropriate timeout on request context.
	//
	// This is experimental option, that is currently off by default.
	Smart *bool

	*TransactionOptions
	*AccessTrackingOptions
}

type RemountTableOptions

type RemountTableOptions struct {
	*TabletRangeOptions
	*MutatingOptions
}

type RemoveMaintenanceOptions added in v0.0.7

type RemoveMaintenanceOptions struct {
	Mine *bool            `http:"mine,omitnil"`
	All  *bool            `http:"all,omitnil"`
	User *string          `http:"user,omitnil"`
	IDs  []MaintenanceID  `http:"ids,omitnil"`
	Type *MaintenanceType `http:"type,omitnil"`
}

func (*RemoveMaintenanceOptions) ValidateFields added in v0.0.7

func (opts *RemoveMaintenanceOptions) ValidateFields() error

type RemoveMaintenanceResponse added in v0.0.7

type RemoveMaintenanceResponse struct {
	BanCounts                  int `yson:"ban"`
	DecommissionCounts         int `yson:"decommission"`
	DisableSchedulerJobsCounts int `yson:"disable_scheduler_jobs"`
	DisableWriteSessionsCounts int `yson:"disable_write_sessions"`
	DisableTabletCellsCounts   int `yson:"disable_tablet_cells"`
	PendingRestartCounts       int `yson:"pending_restart"`
}

type RemoveMemberOptions

type RemoveMemberOptions struct {
	*MutatingOptions
	*PrerequisiteOptions
}

type RemoveNodeOptions

type RemoveNodeOptions struct {
	Recursive bool `http:"recursive"`
	Force     bool `http:"force"`

	*TransactionOptions
	*AccessTrackingOptions
	*PrerequisiteOptions
	*MutatingOptions
}

type RequestRestartOptions added in v0.0.10

type RequestRestartOptions struct {
}

type ReshardTableOptions

type ReshardTableOptions struct {
	*TabletRangeOptions
	*MutatingOptions

	PivotKeys   any  `http:"pivot_keys,omitnil"`
	TabletCount *int `http:"tablet_count,omitnil"`
}

type RestoreTableBackupOptions added in v0.0.10

type RestoreTableBackupOptions struct {
	Force          bool `http:"force"`
	Mount          bool `http:"mount"`
	EnableReplicas bool `http:"enable_replicas"`

	*TimeoutOptions
}

type ResumeOperationOptions

type ResumeOperationOptions struct {
}

type ResurrectChunkLocationsOptions added in v0.0.6

type ResurrectChunkLocationsOptions struct {
}

type ResurrectChunkLocationsResponse added in v0.0.3

type ResurrectChunkLocationsResponse struct {
	LocationUUIDs []guid.GUID
}

type Revision

type Revision uint64

type RevokeTokenOptions added in v0.0.17

type RevokeTokenOptions struct{}

type RowBatch

type RowBatch interface {
	// Len returns estimated memory consumption by this object.
	Len() int
}

RowBatch is serialized blob containing batch of rows.

type RowBatchWriter

type RowBatchWriter interface {
	TableWriter

	Batch() RowBatch
}

type SecurityAction

type SecurityAction string
const (
	ActionAllow SecurityAction = "allow"
	ActionDeny  SecurityAction = "deny"
)

type SelectRowsOptions

type SelectRowsOptions struct {
	FailOnIncompleteResult    *bool `http:"fail_on_incomplete_result,omitnil"`
	InputRowLimit             *int  `http:"input_row_limit,omitnil"`
	OutputRowLimit            *int  `http:"output_row_limit,omitnil"`
	UseCanonicalNullRelations *bool `http:"use_canonical_null_relations,omitnil"`

	Timestamp *Timestamp `http:"timestamp,omitnil"`

	PlaceholderValues any `http:"placeholder_values,omitnil"`

	*TransactionOptions
	*TimeoutOptions
}

type ServiceTicketCredentials

type ServiceTicketCredentials struct {
	Ticket string
}

ServiceTicketCredentials implements TVM service-tickets authentication.

func (*ServiceTicketCredentials) Set

func (*ServiceTicketCredentials) SetExtension

func (c *ServiceTicketCredentials) SetExtension(req *rpc.TRequestHeader)

type SetNodeOptions

type SetNodeOptions struct {
	Recursive bool `http:"recursive"`
	Force     bool `http:"force"`

	*TransactionOptions
	*AccessTrackingOptions
	*MutatingOptions
	*PrerequisiteOptions
}

type SetUserPasswordOptions added in v0.0.17

type SetUserPasswordOptions struct{}

type ShareLocation

type ShareLocation struct {
	Nodes      []NodeAddress `yson:"nodes"`
	ChunkSpecs []ChunkSpec   `yson:"chunk_specs"`
}

type StartOperationOptions

type StartOperationOptions struct {
	*TransactionOptions
	*MutatingOptions
}

type StartQueryOptions added in v0.0.10

type StartQueryOptions struct {
	Settings            any     `http:"settings,omitnil"`
	Draft               *bool   `http:"draft,omitnil"`
	Annotations         any     `http:"annotations,omitnil"`
	AccessControlObject *string `http:"access_control_object,omitnil"`

	*QueryTrackerOptions
}

type StartTabletTxOptions

type StartTabletTxOptions struct {
	Atomicity *Atomicity     `http:"atomicity,omitnil"`
	Timeout   *yson.Duration `http:"timeout,omitnil"`

	Type   TxType `http:"type"`
	Sticky bool   `http:"sticky"`
}

type StartTxOptions

type StartTxOptions struct {
	Timeout  *yson.Duration `http:"timeout,omitnil"`
	Deadline *yson.Time     `http:"deadline,omitnil"`

	Type   *TxType `http:"type,omitnil"`
	Sticky bool    `http:"sticky"`

	PrerequisiteTransactionIDs []TxID         `http:"prerequisite_transaction_ids,omitnil"`
	Attributes                 map[string]any `http:"attributes,omitnil"`

	*TransactionOptions
	*ReadRetryOptions
}

type SuspendOperationOptions

type SuspendOperationOptions struct {
	AbortRunningJobs bool `http:"abort_running_jobs"`
}

type TVMFn

type TVMFn func(ctx context.Context) (string, error)

type TableBackupClient added in v0.0.10

type TableBackupClient interface {
	// http:verb:"create_table_backup"
	// http:params:"manifest"
	CreateTableBackup(
		ctx context.Context,
		manifest BackupManifest,
		options *CreateTableBackupOptions,
	) error

	// http:verb:"restore_table_backup"
	// http:params:"manifest"
	RestoreTableBackup(
		ctx context.Context,
		manifest BackupManifest,
		options *RestoreTableBackupOptions,
	) error
}

type TableBackupManifest added in v0.0.10

type TableBackupManifest struct {
	SourcePath      ypath.Path             `yson:"source_path"`
	DestinationPath ypath.Path             `yson:"destination_path"`
	OrderedMode     OrderedTableBackupMode `yson:"ordered_mode,omitempty"`
}

type TableClient

type TableClient interface {
	// WriteTable opens low-level table writer. Use yt.WriteTable() function instead of calling this method directly.
	//
	// http:verb:"write_table"
	// http:params:"path"
	WriteTable(
		ctx context.Context,
		path ypath.YPath,
		options *WriteTableOptions,
	) (w TableWriter, err error)

	// http:verb:"read_table"
	// http:params:"path"
	ReadTable(
		ctx context.Context,
		path ypath.YPath,
		options *ReadTableOptions,
	) (r TableReader, err error)
}

type TableReader

type TableReader interface {
	// Scan unmarshals current row into value.
	//
	// It is safe to call Scan multiple times for a single row.
	Scan(value any) error

	// Next prepares the next result row for reading with the Scan method.
	//
	// It returns true on success, or false if there is no next result row or an error
	// happened while preparing it. Err should be consulted to distinguish between the two cases.
	Next() bool

	// Err returns error that occurred during read.
	Err() error

	// Close frees any associated resources.
	//
	// User MUST call Close(). Failure to do so will result in resource leak.
	//
	// Error returned from Close() may be safely ignored.
	Close() error
}

TableReader is interface for reading stream of rows.

Example
var r TableReader

_ = func() error {
	// Always close reader to release associated resources.
	defer r.Close()

	var testRow struct {
		Key, Value int
	}

	for r.Next() {
		if err := r.Scan(&testRow); err != nil {
			return err
		}

		// Process row
	}

	// Always check reader Err().
	if r.Err() != nil {
		return r.Err()
	}

	return nil
}()
Output:

type TableReplicaMode

type TableReplicaMode string
var (
	SyncMode  TableReplicaMode = "sync"
	AsyncMode TableReplicaMode = "async"
)

type TableWriter

type TableWriter interface {
	// Write writes single row.
	//
	// Error returned from write indicates that the whole write operation has failed.
	Write(value any) error

	// Commit closes table writer.
	Commit() error

	// Rollback aborts table upload and frees associated resources.
	//
	// It is safe to call Rollback() concurrently with Write or Commit.
	//
	// Rollback blocks until upload transaction is aborted.
	//
	// If you need to cancel table writer without blocking, use context cancelFunc.
	//
	// Error returned from Rollback() may be safely ignored.
	Rollback() error
}

TableWriter is interface for writing stream of rows.

func WriteTable

func WriteTable(ctx context.Context, yc Client, path ypath.Path, opts ...WriteTableOption) (TableWriter, error)

WriteTable creates high level table writer.

By default, WriteTable overrides existing table, automatically creating table with schema inferred from the first row.

type TabletClient

type TabletClient interface {
	// SelectRows executes query.
	//
	// Use strconv.Quote or %q format to escape string literals inside query.
	//
	// http:verb:"select_rows"
	// http:params:"query"
	SelectRows(
		ctx context.Context,
		query string,
		options *SelectRowsOptions,
	) (r TableReader, err error)

	// LookupRows performs lookup by key.
	//
	// Rows are returned in the order of provided keys.
	//
	// By default, returns one row for each key that is present in the table.
	//
	// When KeepMissingRows option is set, returns exactly len(keys) number of rows. If key is missing
	// from the table, corresponding row will be nil.
	//
	// http:verb:"lookup_rows"
	// http:params:"path"
	// http:extra
	LookupRows(
		ctx context.Context,
		path ypath.Path,
		keys []any,
		options *LookupRowsOptions,
	) (r TableReader, err error)

	// LockRows acquires lock for given keys, without changing row values.
	//
	// http:verb:"lock_rows"
	// http:params:"path","locks","lock_type"
	// http:extra
	LockRows(
		ctx context.Context,
		path ypath.Path,
		locks []string,
		lockType LockType,
		keys []any,
		options *LockRowsOptions,
	) (err error)

	// http:verb:"insert_rows"
	// http:params:"path"
	// http:extra
	InsertRows(
		ctx context.Context,
		path ypath.Path,
		rows []any,
		options *InsertRowsOptions,
	) (err error)

	// InsertRowBatch is API optimized for performance.
	//
	// It works just like InsertRows, but allows serializing rows ahead of time.
	InsertRowBatch(
		ctx context.Context,
		path ypath.Path,
		rowBatch RowBatch,
		options *InsertRowsOptions,
	) (err error)

	// http:verb:"delete_rows"
	// http:params:"path"
	// http:extra
	DeleteRows(
		ctx context.Context,
		path ypath.Path,
		keys []any,
		options *DeleteRowsOptions,
	) (err error)
}

type TabletRangeOptions

type TabletRangeOptions struct {
	FirstTabletIndex int `http:"first_tablet_index"`
	LastTabletIndex  int `http:"last_tablet_index"`
}

type TabletTx

type TabletTx interface {
	TabletClient

	ID() TxID
	Commit() error
	Abort() error
}

type TabletTxFunc

type TabletTxFunc func(ctx context.Context, tx TabletTx) error

TabletTxFunc is a callback used in ExecTabletTx function.

type TimeoutOptions

type TimeoutOptions struct {
	Timeout yson.Duration `http:"timeout"`
}

TimeoutOptions specify request timeout that is propagated through internal YT RPC framework.

type Timestamp

type Timestamp uint64

Timestamp is a cluster-wide unique monotonically increasing number used to implement the MVCC.

type TokenCredentials

type TokenCredentials struct {
	Token string
}

func (*TokenCredentials) Set

func (c *TokenCredentials) Set(r *http.Request)

func (*TokenCredentials) SetExtension

func (c *TokenCredentials) SetExtension(req *rpc.TRequestHeader)

type TraceFn

type TraceFn func(ctx context.Context) (traceID guid.GUID, spanID uint64, flags byte, ok bool)

type TrackQueryOptions added in v0.0.10

type TrackQueryOptions struct {
	Logger     log.Structured
	PollPeriod *time.Duration
	*QueryTrackerOptions
}

type TransactionOptions

type TransactionOptions struct {
	TransactionID                      TxID `http:"transaction_id"`
	Ping                               bool `http:"ping"`
	PingAncestors                      bool `http:"ping_ancestor_transactions"`
	SuppressTransactionCoordinatorSync bool `http:"suppress_transaction_coordinator_sync"`
	SuppressUpstreamSync               bool `http:"suppress_upstream_sync"`
}

TransactionOptions control transactional context of cypress command.

Do not use this options directly. Use Transaction instead.

type TransferAccountResourcesOptions

type TransferAccountResourcesOptions struct {
	*MutatingOptions
}

type TransferPoolResourcesOptions

type TransferPoolResourcesOptions struct {
	*MutatingOptions
}

type Tx

type Tx interface {
	CypressClient
	FileClient
	TableClient
	LockClient

	OperationStartClient

	ID() TxID
	Commit() error
	Abort() error

	// Finished returns a channel that is closed when transaction finishes, either because it was committed or aborted.
	Finished() <-chan struct{}

	// BeginTx creates nested transaction.
	BeginTx(ctx context.Context, options *StartTxOptions) (tx Tx, err error)
}

Tx is high level API for master transactions.

Create new tx by calling BeginTx() method on Client or other Tx.

Cleanup of started tx is responsibility of the user. Tx is terminated, either by calling Commit() or Abort(), or by canceling ctx passed to BeginTx().

Unterminated tx will result in goroutine leak.

type TxFunc

type TxFunc func(ctx context.Context, tx Tx) error

TxFunc is a callback used in ExecTx function.

type TxID

type TxID guid.GUID

func (TxID) MarshalYSON

func (id TxID) MarshalYSON(w *yson.Writer) error

func (TxID) String

func (id TxID) String() string

func (*TxID) UnmarshalYSON

func (id *TxID) UnmarshalYSON(data []byte) (err error)

type TxType

type TxType string
var (
	TxTypeMaster TxType = "master"
	TxTypeTablet TxType = "tablet"
)

type UnfreezeTableOptions

type UnfreezeTableOptions struct {
	*TabletRangeOptions
	*MutatingOptions
}

type UnlockNodeOptions

type UnlockNodeOptions struct {
	*TransactionOptions
	*MutatingOptions
}

type UnmountTableOptions

type UnmountTableOptions struct {
	*TabletRangeOptions
	*MutatingOptions

	Force bool `http:"force"`
}

type UpdateOperationParametersOptions

type UpdateOperationParametersOptions struct {
}

type UserTicketCredentials

type UserTicketCredentials struct {
	Ticket string
}

UserTicketCredentials implements TVM user-tickets authentication.

func (*UserTicketCredentials) Set

func (c *UserTicketCredentials) Set(r *http.Request)

func (*UserTicketCredentials) SetExtension

func (c *UserTicketCredentials) SetExtension(req *rpc.TRequestHeader)

type WriteFileOptions

type WriteFileOptions struct {
	ComputeMD5 bool `http:"compute_md5"`
	FileWriter any  `http:"file_writer"`

	*TransactionOptions
	*PrerequisiteOptions
}

type WriteTableOption

type WriteTableOption func(*tableWriter)

func WithBatchSize

func WithBatchSize(batchSize int) WriteTableOption

WithBatchSize sets batch size (in bytes) for WriteTable.

func WithCreateOptions

func WithCreateOptions(opts ...CreateTableOption) WriteTableOption

WithCreateOptions disables default behavior of creating table on first Write().

Instead, table is created when WriteTable() is called.

func WithExistingTable

func WithExistingTable() WriteTableOption

WithExisting table disables automatic table creation.

func WithTableWriterConfig

func WithTableWriterConfig(config map[string]any) WriteTableOption

type WriteTableOptions

type WriteTableOptions struct {
	TableWriter any `http:"table_writer"`

	*TransactionOptions
	*AccessTrackingOptions
}

Directories

Path Synopsis
package ythttp provides YT client over HTTP protocol.
package ythttp provides YT client over HTTP protocol.

Jump to

Keyboard shortcuts

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