api

package
v1.3.15 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: MIT Imports: 29 Imported by: 6

Documentation

Overview

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package api provides AIStore API over HTTP(S)

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Index

Constants

View Source
const (
	StatusOnline   = "online"
	StatusOffline  = "offline"
	StatusTimedOut = "timed out"
)

Variables

This section is empty.

Functions

func AbortDSort

func AbortDSort(bp BaseParams, managerUUID string) error

func AbortDownload

func AbortDownload(bp BaseParams, id string) error

func AbortXaction

func AbortXaction(bp BaseParams, args XactReqArgs) error

AbortXaction aborts a given xact.

func AccessAttrs

func AccessAttrs(v apc.AccessAttrs) *apc.AccessAttrs

AccessAttrs returns a pointer to the AccessAttr value passed in.

func AppendObject

func AppendObject(args AppendArgs) (string, error)

AppendObject adds a reader (`args.Reader` - e.g., an open file) to an object. The API can be called multiple times - each call returns a handle that may be used for subsequent append requests. Once all the "appending" is done, the caller must call `api.FlushObject` to finalize the object. NOTE: object becomes visible and accessible only _after_ the call to `api.FlushObject`.

func AppendToArch

func AppendToArch(args AppendToArchArgs) (err error)

Append the content of a reader (`args.Reader` - e.g., an open file) to an existing object formatted as one of the supported archives. In other words, append to an existing archive. For supported archival (mime) types, see cmn/cos/archive.go. NOTE: compare with:

  • `api.CreateArchMultiObj`
  • `api.AppendObject`

func AttachMountpath

func AttachMountpath(bp BaseParams, node *cluster.Snode, mountpath string, force bool) error

TODO: rewrite tests that come here with `force`

func AttachRemoteAIS

func AttachRemoteAIS(bp BaseParams, alias, u string) error

func Bool

func Bool(v bool) *bool

Bool returns a pointer to the bool value passed in.

func CopyBucket

func CopyBucket(bp BaseParams, fromBck, toBck cmn.Bck, msg *apc.CopyBckMsg) (xactID string, err error)

CopyBucket copies existing `fromBck` bucket to the destination `toBck` thus, effectively, creating a copy of the `fromBck`.

  • AIS will create `toBck` on the fly but only if the destination bucket does not exist and _is_ provided by AIStore; 3rd party backend destination must exist - otherwise the copy operation won't be successful.
  • There are no limitations on copying buckets across Backend providers: you can copy AIS bucket to (or from) AWS bucket, and the latter to Google or Azure bucket, etc.
  • Copying multiple buckets to the same destination bucket is also permitted.

func CopyMultiObj

func CopyMultiObj(bp BaseParams, fromBck cmn.Bck, msg cmn.TCObjsMsg) (xactID string, err error)

func CreateArchMultiObj

func CreateArchMultiObj(bp BaseParams, fromBck cmn.Bck, msg cmn.ArchiveMsg) (string, error)

CreateArchMultiObj allows to archive multiple objects. The option to append multiple objects to an existing archive is also supported. The source and the destination buckets are defined as `fromBck` and `toBck`, respectively (not necessarily distinct) For supported archiving formats, see `cos.ArchExtensions`. NOTE: compare with `api.AppendToArch`

func CreateBucket

func CreateBucket(bp BaseParams, bck cmn.Bck, props *cmn.BucketPropsToUpdate) error

CreateBucket sends request to create an AIS bucket with the given name and, optionally, specific non-default properties (via cmn.BucketPropsToUpdate).

See also:

  • github.com/NVIDIA/aistore/blob/master/docs/bucket.md#default-bucket-properties
  • cmn.BucketPropsToUpdate (cmn/api.go)

Bucket properties can be also changed at any time via SetBucketProps (above).

func DecommissionCluster

func DecommissionCluster(bp BaseParams, rmUserData bool) error

DecommissionCluster permanently decommissions entire cluster

func DecommissionNode

func DecommissionNode(bp BaseParams, actValue *apc.ActValRmNode) (xid string, err error)

func DeleteList

func DeleteList(bp BaseParams, bck cmn.Bck, filesList []string) (string, error)

DeleteList sends request to remove a list of objects from a bucket.

func DeleteObject

func DeleteObject(bp BaseParams, bck cmn.Bck, object string) error

DeleteObject deletes an object specified by bucket/object.

func DeleteRange

func DeleteRange(bp BaseParams, bck cmn.Bck, rng string) (string, error)

DeleteRange sends request to remove a range of objects from a bucket.

func DestroyBucket

func DestroyBucket(bp BaseParams, bck cmn.Bck) error

DestroyBucket sends request to remove an AIS bucket with the given name.

func DetachMountpath

func DetachMountpath(bp BaseParams, node *cluster.Snode, mountpath string, dontResilver bool) error

func DetachRemoteAIS

func DetachRemoteAIS(bp BaseParams, alias string) error

func DisableMountpath

func DisableMountpath(bp BaseParams, node *cluster.Snode, mountpath string, dontResilver bool) error

func DoWithRetry

func DoWithRetry(client *http.Client, cb NewRequestCB, reqArgs *cmn.HreqArgs) (resp *http.Response, err error)

DoWithRetry executes `http-client.Do` and retries *retriable connection errors*, such as "broken pipe" and "connection refused".

This function always closes the `reqArgs.BodR`, even in case of error.

Should be used for PUT requests as it puts reader into a request.

NOTE: always closes request body reader (reqArgs.BodyR) - explicitly or via Do() TODO: this code must be totally revised

func DownloadBackend

func DownloadBackend(bp BaseParams, description string, bck cmn.Bck, prefix, suffix string,
	intervals ...time.Duration) (string, error)

func DownloadGetList

func DownloadGetList(bp BaseParams, regex string) (dlList downloader.DlJobInfos, err error)

func DownloadMulti

func DownloadMulti(bp BaseParams, description string, bck cmn.Bck, msg any, intervals ...time.Duration) (string, error)

func DownloadRange

func DownloadRange(bp BaseParams, description string, bck cmn.Bck, template string, intervals ...time.Duration) (string, error)

func DownloadSingle

func DownloadSingle(bp BaseParams, description string,
	bck cmn.Bck, objName, link string, intervals ...time.Duration) (string, error)

func DownloadStatus

func DownloadStatus(bp BaseParams, id string, onlyActiveTasks ...bool) (resp downloader.DlStatusResp, err error)

func DownloadWithParam

func DownloadWithParam(bp BaseParams, dlt downloader.DlType, body any) (id string, err error)

func Duration

func Duration(v time.Duration) *time.Duration

Duration returns a pointer to the time duration value passed in.

func ECEncodeBucket

func ECEncodeBucket(bp BaseParams, bck cmn.Bck, data, parity int) (xactID string, err error)

func ETLBucket

func ETLBucket(bp BaseParams, fromBck, toBck cmn.Bck, bckMsg *apc.TCBMsg) (xactID string, err error)

func ETLDelete

func ETLDelete(bp BaseParams, id string) (err error)

func ETLGetInitMsg

func ETLGetInitMsg(params BaseParams, id string) (initMsg etl.InitMsg, err error)

func ETLHealth

func ETLHealth(params BaseParams, id string) (healths etl.PodsHealthMsg, err error)

func ETLInit

func ETLInit(bp BaseParams, msg etl.InitMsg) (id string, err error)

func ETLList

func ETLList(bp BaseParams) (list []etl.Info, err error)

func ETLLogs

func ETLLogs(bp BaseParams, id string, targetID ...string) (logs etl.PodsLogsMsg, err error)

func ETLMultiObj

func ETLMultiObj(bp BaseParams, fromBck cmn.Bck, msg cmn.TCObjsMsg) (xactID string, err error)

func ETLObject

func ETLObject(bp BaseParams, id string, bck cmn.Bck, objName string, w io.Writer) (err error)

TODO: add ETL-specific query param and change the examples/docs (!4455)

func ETLStart

func ETLStart(bp BaseParams, id string) (err error)

func ETLStop

func ETLStop(bp BaseParams, id string) (err error)

func EnableMountpath

func EnableMountpath(bp BaseParams, node *cluster.Snode, mountpath string) error

func EvictList

func EvictList(bp BaseParams, bck cmn.Bck, fileslist []string) (string, error)

EvictList sends request to evict a list of objects from a remote bucket.

func EvictObject

func EvictObject(bp BaseParams, bck cmn.Bck, object string) error

EvictObject evicts an object specified by bucket/object.

func EvictRange

func EvictRange(bp BaseParams, bck cmn.Bck, rng string) (string, error)

EvictRange sends request to evict a range of objects from a remote bucket.

func EvictRemoteBucket

func EvictRemoteBucket(bp BaseParams, bck cmn.Bck, keepMD bool) error

EvictRemoteBucket sends request to evict an entire remote bucket from the AIStore - keepMD: evict objects but keep bucket metadata

func FlushObject

func FlushObject(args FlushArgs) error

FlushObject must be called after all the appends (via `api.AppendObject`). To "flush", it uses the handle returned by `api.AppendObject`. This call will create a fully operational and accessible object.

func FreeRp

func FreeRp(reqParams *ReqParams)

func GetBMD

func GetBMD(bp BaseParams) (*cluster.BMD, error)

GetBMD returns bucket metadata

func GetBucketInfo

func GetBucketInfo(bp BaseParams, bck cmn.Bck, fltPresence int) (p *cmn.BucketProps, info *cmn.BsummResult, err error)

Bucket information - a runtime addendum to `BucketProps`. Unlike `cmn.BucketProps` properties (which are user configurable), bucket runtime info: - includes usage, capacity, other statistics - is obtained via GetBucketInfo() API - delivered via apc.HdrBucketInfo header (compare with GetBucketSummary) The API utilizes HEAD method (compare with HeadBucket above)

func GetBucketSummary

func GetBucketSummary(bp BaseParams, qbck cmn.QueryBcks, msg *cmn.BsummCtrlMsg) (cmn.AllBsummResults, error)

GetBucketSummary returns bucket summaries (i.e., capcity ulitization stats and numbers of objects) for the specified bucket or buckets, as per `cmn.QueryBcks` query. E.g., an empty bucket query corresponds to all buckets present in the cluster's metadata.

func GetClusterConfig

func GetClusterConfig(bp BaseParams) (*cmn.ClusterConfig, error)

GetClusterConfig returns cluster-wide configuration

func GetClusterMap

func GetClusterMap(bp BaseParams) (smap *cluster.Smap, err error)

GetClusterMap retrieves AIStore cluster map.

func GetClusterStats

func GetClusterStats(bp BaseParams) (res stats.ClusterStats, err error)

GetClusterStats retrieves AIStore cluster stats (all targets and current proxy).

func GetClusterSysInfo

func GetClusterSysInfo(bp BaseParams) (info apc.ClusterSysInfo, err error)

GetClusterSysInfo retrieves AIStore system info.

func GetDaemonConfig

func GetDaemonConfig(bp BaseParams, node *cluster.Snode) (config *cmn.Config, err error)

GetDaemonConfig returns the configuration of a specific daemon in a cluster.

func GetDaemonLog

func GetDaemonLog(bp BaseParams, node *cluster.Snode, args GetLogInput) error

GetDaemonLog returns log of a specific daemon in a cluster.

func GetDaemonStats

func GetDaemonStats(bp BaseParams, node *cluster.Snode) (ds *stats.DaemonStats, err error)

func GetDaemonStatus

func GetDaemonStatus(bp BaseParams, node *cluster.Snode) (daeInfo *stats.DaemonStatus, err error)

GetDaemonStatus returns information about specific node in a cluster.

func GetMountpaths

func GetMountpaths(bp BaseParams, node *cluster.Snode) (mpl *apc.MountpathList, err error)

GetMountpaths given the direct public URL of the target, returns the target's mountpaths or error.

func GetNodeClusterMap

func GetNodeClusterMap(bp BaseParams, sid string) (smap *cluster.Smap, err error)

GetNodeClusterMap retrieves AIStore cluster map from specific node.

func GetObject

func GetObject(bp BaseParams, bck cmn.Bck, object string, options ...GetObjectInput) (n int64, err error)

GetObject returns the length of the object. Does not validate checksum of the object in the response.

Writes the response body to a writer if one is specified in the optional `GetObjectInput.Writer`. Otherwise, it discards the response body read.

`io.Copy` is used internally to copy response bytes from the request to the writer.

func GetObjectReader

func GetObjectReader(bp BaseParams, bck cmn.Bck, object string, options ...GetObjectInput) (r io.ReadCloser, err error)

GetObjectReader returns reader of the requested object. It does not read body bytes, nor validates a checksum. Caller is responsible for closing the reader.

func GetObjectS3

func GetObjectS3(bp BaseParams, bck cmn.Bck, objectName string, options ...GetObjectInput) (int64, error)

s3/<bucket-name>/<object-name>

func GetObjectWithResp

func GetObjectWithResp(bp BaseParams, bck cmn.Bck, object string, options ...GetObjectInput) (*http.Response,
	int64, error)

GetObjectWithResp returns the response and the length of the object. It does not validate the checksum of the object in the response.

Writes the response body to a writer if one is specified in the optional `GetObjectInput.Writer`. Otherwise, it discards the response body read.

`io.Copy` is used internally to copy response bytes from the request to the writer.

func GetObjectWithValidation

func GetObjectWithValidation(bp BaseParams, bck cmn.Bck, object string, options ...GetObjectInput) (n int64, err error)

GetObjectWithValidation has same behavior as GetObject, but performs checksum validation of the object by comparing the checksum in the response header with the calculated checksum value derived from the returned object.

Similar to GetObject, if a memory manager/slab allocator is not specified, a temporary buffer is allocated when reading from the response body to compute the object checksum.

Returns `cmn.ErrInvalidCksum` when the expected and actual checksum values are different.

func GetProxyReadiness

func GetProxyReadiness(bp BaseParams) error

to be used by external watchdogs (Kubernetes, etc.) (compare with api.Health below)

func GetRemoteAIS

func GetRemoteAIS(bp BaseParams) (remais cluster.Remotes, err error)

func GetTargetDiskStats

func GetTargetDiskStats(bp BaseParams, tid string) (res ios.AllDiskStats, err error)

func GetWhatRawQuery

func GetWhatRawQuery(getWhat, getProps string) string

func GetXactionStatus

func GetXactionStatus(bp BaseParams, args XactReqArgs) (status *nl.NotifStatus, err error)

GetXactionStatus retrieves the status of the xact.

func HTTPStatus

func HTTPStatus(err error) int

HTTPStatus returns HTTP status or (-1) for non-HTTP error.

func HeadBucket

func HeadBucket(bp BaseParams, bck cmn.Bck, dontAddRemote bool) (p *cmn.BucketProps, err error)

HEAD(bucket): apc.HdrBucketProps => cmn.BucketProps{} and apc.HdrBucketInfo => BucketInfo{}

Converts the string type fields returned from the HEAD request to their corresponding counterparts in the cmn.BucketProps struct.

By default, AIStore adds remote buckets to the cluster metadata on the fly. Remote bucket that was never accessed before just "shows up" when user performs HEAD, PUT, GET, SET-PROPS, and a variety of other operations. This is done only once (and after confirming the bucket's existence and accessibility) and doesn't require any action from the user. Use `dontAddRemote` to override the default behavior: as the name implies, setting `dontAddRemote = true` prevents AIS from adding remote bucket to the cluster's metadata.

func HeadObject

func HeadObject(bp BaseParams, bck cmn.Bck, object string, fltPresence int) (*cmn.ObjectProps, error)

HeadObject returns object properties; can be conventionally used to establish in-cluster presence.

func Health

func Health(bp BaseParams, readyToRebalance ...bool) error

func HealthUptime

func HealthUptime(bp BaseParams, readyToRebalance ...bool) (string, string, error)

func Int

func Int(v int) *int

Int returns a pointer to the int value passed in.

func Int64

func Int64(v int64) *int64

Int64 returns a pointer to the int64 value passed in.

func JoinCluster

func JoinCluster(bp BaseParams, nodeInfo *cluster.Snode) (rebID, sid string, err error)

JoinCluster add a node to a cluster.

func ListBuckets

func ListBuckets(bp BaseParams, qbck cmn.QueryBcks, fltPresence int) (cmn.Bcks, error)

ListBuckets returns buckets for provided query, where `fltPresence` is one of { apc.FltExists, apc.FltPresent, ... } (ListBuckets must not be confused with `ListObjects()` and friends below).

func ListDSort

func ListDSort(bp BaseParams, regex string) (jobsInfos []*dsort.JobInfo, err error)

func ListObjects

func ListObjects(bp BaseParams, bck cmn.Bck, lsmsg *apc.LsoMsg, numObj uint) (*cmn.LsoResult, error)

ListObjects returns a list of objects in a bucket - a slice of structures in the `cmn.LsoResult` that look like `cmn.LsoEntry`.

The `numObjects` argument is the maximum number of objects to be returned (where 0 (zero) means returning all objects in the bucket).

This API supports numerous options and flags. In particular, `apc.LsoMsg` supports "opening" objects formatted as one of the supported archival types and include contents of archived directories in generated result sets. In addition, `apc.LsoMsg` provides options (flags) to optimize ListObjects performance, to list anonymous public-access Cloud buckets, and more. For detals, see: `api/apc/lsmsg.go` source.

AIS fully supports listing buckets that may have millions of objects. For large and very large buckets, it is strongly recommended to use ListObjectsPage that will return the very first (listed) page and a so called "continuation token".

See also: - `ListObjectsPage` below. - usage examples, see CLI docs under docs/cli.

func ListObjectsInvalidateCache

func ListObjectsInvalidateCache(bp BaseParams, bck cmn.Bck) error

TODO: obsolete this function after introducing mechanism to detect remote bucket changes.

func ListObjectsPage

func ListObjectsPage(bp BaseParams, bck cmn.Bck, lsmsg *apc.LsoMsg) (*cmn.LsoResult, error)

ListObjectsPage returns the first page of bucket objects. On success the function updates `lsmsg.ContinuationToken` which client then can reuse to fetch the next page. See also: CLI and CLI usage examples See also: `apc.LsoMsg` See also: `api.ListObjectsInvalidateCache` See also: `api.ListObjects`

func ListObjectsWithOpts

func ListObjectsWithOpts(bp BaseParams, bck cmn.Bck, lsmsg *apc.LsoMsg, numObj uint,
	progress *ProgressContext) (lst *cmn.LsoResult, err error)

additional argument may include "progress-bar" context

func MakeNCopies

func MakeNCopies(bp BaseParams, bck cmn.Bck, copies int) (xactID string, err error)

MakeNCopies starts an extended action (xaction) to bring a given bucket to a certain redundancy level (num copies).

func MetricsDSort

func MetricsDSort(bp BaseParams, managerUUID string) (metrics map[string]*dsort.Metrics, err error)

func PrefetchList

func PrefetchList(bp BaseParams, bck cmn.Bck, fileslist []string) (string, error)

PrefetchList sends request to prefetch a list of objects from a remote bucket.

func PrefetchRange

func PrefetchRange(bp BaseParams, bck cmn.Bck, rng string) (string, error)

PrefetchRange sends request to prefetch a range of objects from a remote bucket.

func Promote

func Promote(args *PromoteArgs) (xactID string, err error)

promote files and directories to ais objects

func PutObject

func PutObject(args PutObjectArgs) (err error)

PutObject creates an object from the body of the reader (`args.Reader`) and puts it in the specified bucket.

Assumes that `args.Reader` is already opened and ready for usage.

func QueryBuckets

func QueryBuckets(bp BaseParams, qbck cmn.QueryBcks, fltPresence int) (bool, error)

QueryBuckets is a little convenience helper. It returns true if the selection contains at least one bucket that satisfies the (qbck) criteria.

func RemoveDSort

func RemoveDSort(bp BaseParams, managerUUID string) error

func RemoveDownload

func RemoveDownload(bp BaseParams, id string) error

func RemoveNodeFromSmap

func RemoveNodeFromSmap(bp BaseParams, sid string) error

Remove a node from Smap immediately. Immediately removes a node from Smap (advanced usage - potential data loss)

func RenameBucket

func RenameBucket(bp BaseParams, fromBck, toBck cmn.Bck) (xactID string, err error)

RenameBucket renames fromBck as toBck.

func RenameObject

func RenameObject(bp BaseParams, bck cmn.Bck, oldName, newName string) error

RenameObject renames object name from `oldName` to `newName`. Works only across single, specified bucket.

func ResetBucketProps

func ResetBucketProps(bp BaseParams, bck cmn.Bck, query ...url.Values) (string, error)

ResetBucketProps resets the properties of a bucket to the global configuration.

func ResetClusterConfig

func ResetClusterConfig(bp BaseParams) error

ResetClusterConfig resets the configuration of all nodes to the cluster configuration

func ResetDaemonConfig

func ResetDaemonConfig(bp BaseParams, nodeID string) error

ResetDaemonConfig resets the configuration for a specific node to the cluster configuration.

func SetAuxHeaders

func SetAuxHeaders(r *http.Request, bp *BaseParams)

func SetBucketProps

func SetBucketProps(bp BaseParams, bck cmn.Bck, props *cmn.BucketPropsToUpdate, query ...url.Values) (string, error)

SetBucketProps sets the properties of a bucket. Validation of the properties passed in is performed by AIStore Proxy.

func SetClusterConfig

func SetClusterConfig(bp BaseParams, nvs cos.StrKVs, transient bool) error

SetClusterConfig given key-value pairs of cluster configuration parameters, sets the cluster-wide configuration accordingly. Setting cluster-wide configuration requires sending the request to a proxy.

func SetClusterConfigUsingMsg

func SetClusterConfigUsingMsg(bp BaseParams, configToUpdate *cmn.ConfigToUpdate, transient bool) error

SetClusterConfigUsingMsg sets the cluster-wide configuration using the `cmn.ConfigToUpdate` parameter provided.

func SetDaemonConfig

func SetDaemonConfig(bp BaseParams, nodeID string, nvs cos.StrKVs, transient ...bool) error

SetDaemonConfig, given key value pairs, sets the configuration accordingly for a specific node.

func SetObjectCustomProps

func SetObjectCustomProps(bp BaseParams, bck cmn.Bck, object string, custom cos.StrKVs, setNew bool) error

Given cos.StrKVs (map[string]string) keys and values, sets object's custom properties. By default, adds new or updates existing custom keys. Use `setNewCustomMDFlag` to _replace_ all existing keys with the specified (new) ones. See also: HeadObject() and apc.HdrObjCustomMD

func SetPrimaryProxy

func SetPrimaryProxy(bp BaseParams, newPrimaryID string, force bool) error

SetPrimaryProxy given a daemonID sets that corresponding proxy as the primary proxy of the cluster.

func ShutdownCluster

func ShutdownCluster(bp BaseParams) error

ShutdownCluster shuts down the whole cluster

func ShutdownNode

func ShutdownNode(bp BaseParams, actValue *apc.ActValRmNode) (id string, err error)

ShutdownNode shuts down a specific node

func StartDSort

func StartDSort(bp BaseParams, rs dsort.RequestSpec) (string, error)

func StartMaintenance

func StartMaintenance(bp BaseParams, actValue *apc.ActValRmNode) (xid string, err error)

func StartXaction

func StartXaction(bp BaseParams, args XactReqArgs) (id string, err error)

StartXaction starts a given xact.

func StopMaintenance

func StopMaintenance(bp BaseParams, actValue *apc.ActValRmNode) (xid string, err error)

func String

func String(v string) *string

String returns a pointer to the string value passed in.

func WaitForXactionIC

func WaitForXactionIC(bp BaseParams, args XactReqArgs) (status *nl.NotifStatus, err error)

WaitForXactionIC waits for a given xaction to complete. Use it only for global xactions (those that execute on all targets and report their status to IC, e.g. rebalance).

func WaitForXactionIdle

func WaitForXactionIdle(bp BaseParams, args XactReqArgs) error

WaitForXactionIdle waits for a given on-demand xaction to be idle.

func WaitForXactionNode

func WaitForXactionNode(bp BaseParams, args XactReqArgs, fn func(NodesXactMultiSnap) bool) error

WaitForXactionNode waits for a given xaction to complete. Use for xaction which can be launched on a single node and do not report their statuses(e.g resilver) to IC or to check specific xaction states (e.g Idle).

func WritePolicy

func WritePolicy(v apc.WritePolicy) *apc.WritePolicy

Types

type AppendArgs

type AppendArgs struct {
	Reader     cos.ReadOpenCloser
	BaseParams BaseParams
	Bck        cmn.Bck
	Object     string
	Handle     string
	Size       int64
}

type AppendToArchArgs

type AppendToArchArgs struct {
	ArchPath string
	PutObjectArgs
}

type BaseParams

type BaseParams struct {
	Client *http.Client
	URL    string
	Method string
	Token  string
	UA     string
}

type FlushArgs

type FlushArgs struct {
	Cksum      *cos.Cksum
	BaseParams BaseParams
	Bck        cmn.Bck
	Object     string
	Handle     string
}

type GetLogInput

type GetLogInput struct {
	Writer   io.Writer
	Severity string // one of: {cmn.LogInfo, ...}
}

type GetObjectInput

type GetObjectInput struct {
	// If not specified otherwise, the Writer field defaults to io.Discard
	Writer io.Writer
	// Map of strings as keys and string slices as values used for url formulation
	Query url.Values
	// Custom header values passed with GET request
	Header http.Header
}

type NewRequestCB

type NewRequestCB func(args *cmn.HreqArgs) (*http.Request, error)

type NodesXactMultiSnap

type NodesXactMultiSnap map[string][]*xact.SnapExt

func QueryXactionSnaps

func QueryXactionSnaps(bp BaseParams, args XactReqArgs) (xs NodesXactMultiSnap, err error)

QueryXactionSnaps gets all xaction snaps based on the specified selection.

func (NodesXactMultiSnap) ByteCounts

func (xs NodesXactMultiSnap) ByteCounts() (locBytes, outBytes, inBytes int64)

func (NodesXactMultiSnap) Idle

func (xs NodesXactMultiSnap) Idle() bool

func (NodesXactMultiSnap) ObjCounts

func (xs NodesXactMultiSnap) ObjCounts() (locObjs, outObjs, inObjs int64)

func (NodesXactMultiSnap) Running

func (xs NodesXactMultiSnap) Running() (tid string, xsnap *xact.SnapExt)

type NodesXactSnap

type NodesXactSnap map[string]*xact.SnapExt

func GetXactionSnapsByID

func GetXactionSnapsByID(bp BaseParams, xactID string) (nxs NodesXactSnap, err error)

GetXactionSnapsByID gets all xaction snaps for a given xaction id.

func (NodesXactSnap) ByteCounts

func (nxs NodesXactSnap) ByteCounts() (locBytes, outBytes, inBytes int64)

func (NodesXactSnap) Finished

func (nxs NodesXactSnap) Finished() bool

func (NodesXactSnap) IsAborted

func (nxs NodesXactSnap) IsAborted() bool

func (NodesXactSnap) ObjCounts

func (nxs NodesXactSnap) ObjCounts() (locObjs, outObjs, inObjs int64)

func (NodesXactSnap) TotalRunningTime

func (nxs NodesXactSnap) TotalRunningTime() time.Duration

type ProgressCallback

type ProgressCallback = func(pi *ProgressContext)

"progress bar" control structures and context

type ProgressContext

type ProgressContext struct {
	// contains filtered or unexported fields
}

"progress bar" control structures and context

func NewProgressContext

func NewProgressContext(cb ProgressCallback, after time.Duration) *ProgressContext

func (*ProgressContext) Elapsed

func (ctx *ProgressContext) Elapsed() time.Duration

func (*ProgressContext) Info

func (ctx *ProgressContext) Info() ProgressInfo

func (*ProgressContext) IsFinished

func (ctx *ProgressContext) IsFinished() bool

type ProgressInfo

type ProgressInfo struct {
	Percent float64
	Count   int
	Total   int
}

negative values indicate that progress information is unavailable

type PromoteArgs

type PromoteArgs struct {
	BaseParams BaseParams
	Bck        cmn.Bck
	cluster.PromoteArgs
}

type PutObjectArgs

type PutObjectArgs struct {
	Reader cos.ReadOpenCloser
	Cksum  *cos.Cksum

	BaseParams BaseParams
	Bck        cmn.Bck

	Object string
	Size   uint64 // optional

	// Skip loading existing object's metadata in order to
	// compare its Checksum and update its existing Version (if exists);
	// can be used to reduce PUT latency when:
	// - we massively write a new content into a bucket, and/or
	// - we simply don't care.
	SkipVC bool
}

type ReqParams

type ReqParams struct {
	Query  url.Values
	Header http.Header

	BaseParams BaseParams

	Path string

	// Authentication
	User     string
	Password string

	Body []byte

	// Determines if the response should be validated with the checksum
	Validate bool
}

ReqParams is used in constructing client-side API requests to the AIStore. Stores Query and Headers for providing arguments that are not used commonly in API requests

func AllocRp

func AllocRp() *ReqParams

func (*ReqParams) DoReqResp

func (reqParams *ReqParams) DoReqResp(v any) error

(see below)

func (*ReqParams) DoRequest

func (reqParams *ReqParams) DoRequest() error

uses do() to make the request; if successful, checks, drains, and closes the response body

func (*ReqParams) DoRequestHdr

func (reqParams *ReqParams) DoRequestHdr() (http.Header, error)

same as above except that it also returns response header

type XactReqArgs

type XactReqArgs struct {
	// either xaction ID or Kind _must_ be specified
	ID   string // xaction UUID
	Kind string // xaction kind, see `xact.Table`)
	// optional parameters to further narrow down or filter out xactions in question
	DaemonID string    // node that runs this xaction
	Bck      cmn.Bck   // bucket
	Buckets  []cmn.Bck // list of buckets (e.g., copy-bucket, lru-evict, etc.)
	// max time to wait and other "non-filters"
	Timeout time.Duration
	Force   bool // force
	// more filters
	OnlyRunning bool // look only for running xactions
}

type XactStatsHelper

type XactStatsHelper interface {
	Running() bool
	Finished() bool
	Aborted() bool
	ObjCount() int64
}

Directories

Path Synopsis
Package apc: API messages and constants
Package apc: API messages and constants
Package authn provides AuthN API over HTTP(S)
Package authn provides AuthN API over HTTP(S)
Package env contains environment variables
Package env contains environment variables

Jump to

Keyboard shortcuts

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