madmin

package
v0.0.0-...-d9564d9 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

README

Golang Admin Client API Reference Slack

The MinIO Admin Golang Client SDK provides APIs to manage MinIO services.

This quickstart guide will show you how to install the MinIO Admin client SDK, connect to MinIO admin service, and provide a walkthrough of a simple file uploader.

This document assumes that you have a working Golang setup.

Initialize MinIO Admin Client object.

MinIO


package main

import (
    "fmt"

    "github.com/minio/minio/pkg/madmin"
)

func main() {
    // Use a secure connection.
    ssl := true

    // Initialize minio client object.
    mdmClnt, err := madmin.New("your-minio.example.com:9000", "YOUR-ACCESSKEYID", "YOUR-SECRETKEY", ssl)
    if err != nil {
        fmt.Println(err)
        return
    }

    // Fetch service status.
    st, err := mdmClnt.ServiceStatus()
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Printf("%#v\n", st)
}

Service operations Info operations Healing operations Config operations Top operations IAM operations Misc
ServiceStatus ServerInfo Heal GetConfig TopLocks AddUser
ServiceSendAction ServerCPULoadInfo SetConfig SetUserPolicy StartProfiling
Trace ServerMemUsageInfo GetConfigKeys ListUsers DownloadProfilingData
SetConfigKeys AddCannedPolicy

1. Constructor

New(endpoint string, accessKeyID string, secretAccessKey string, ssl bool) (*AdminClient, error)

Initializes a new admin client object.

Parameters

Param Type Description
endpoint string MinIO endpoint.
accessKeyID string Access key for the object storage endpoint.
secretAccessKey string Secret key for the object storage endpoint.
ssl bool Set this value to 'true' to enable secure (HTTPS) access.

2. Admin API Version

VersionInfo() (AdminAPIVersionInfo, error)

Fetch server's supported Administrative API version.

Example


	info, err := madmClnt.VersionInfo()
	if err != nil {
		log.Fatalln(err)
	}
	log.Printf("%s\n", info.Version)

3. Service operations

ServiceStatus() (ServiceStatusMetadata, error)

Fetch service status, replies disk space used, backend type and total disks offline/online (applicable in distributed mode).

Param Type Description
serviceStatus ServiceStatusMetadata Represents current server status info in following format:
Param Type Description
st.ServerVersion.Version string Server version.
st.ServerVersion.CommitID string Server commit id.
st.Uptime time.Duration Server uptime duration in seconds.

Example


   st, err := madmClnt.ServiceStatus()
   if err != nil {
   	log.Fatalln(err)
   }
   log.Printf("%#v\n", st)

ServiceSendAction(act ServiceActionValue) (error)

Sends a service action command to service - possible actions are restarting and stopping the server.

Example

       // to restart
   st, err := madmClnt.ServiceSendAction(ServiceActionValueRestart)
       // or to stop
       // st, err := madmClnt.ServiceSendAction(ServiceActionValueStop)
   if err != nil {
   	log.Fatalln(err)
   }
   log.Printf("Success")

4. Info operations

ServerInfo() ([]ServerInfo, error)

Fetches information for all cluster nodes, such as server properties, storage information, network statistics, etc.

Param Type Description
si.Addr string Address of the server the following information is retrieved from.
si.ConnStats ServerConnStats Connection statistics from the given server.
si.HTTPStats ServerHTTPStats HTTP connection statistics from the given server.
si.Properties ServerProperties Server properties such as region, notification targets.
si.Data.StorageInfo.Used int64 Used disk space.
si.Data.StorageInfo.Total int64 Total disk space.
si.Data.StorageInfo.Available int64 Available disk space.
si.Data.StorageInfo.Backend struct{} Represents backend type embedded structure.
Param Type Description
ServerProperties.Uptime time.Duration Total duration in seconds since server is running.
ServerProperties.Version string Current server version.
ServerProperties.CommitID string Current server commitID.
ServerProperties.Region string Configured server region.
ServerProperties.SQSARN []string List of notification target ARNs.
Param Type Description
ServerConnStats.TotalInputBytes uint64 Total bytes received by the server.
ServerConnStats.TotalOutputBytes uint64 Total bytes sent by the server.
Param Type Description
ServerHTTPStats.TotalHEADStats ServerHTTPMethodStats Total statistics regarding HEAD operations
ServerHTTPStats.SuccessHEADStats ServerHTTPMethodStats Total statistics regarding successful HEAD operations
ServerHTTPStats.TotalGETStats ServerHTTPMethodStats Total statistics regarding GET operations
ServerHTTPStats.SuccessGETStats ServerHTTPMethodStats Total statistics regarding successful GET operations
ServerHTTPStats.TotalPUTStats ServerHTTPMethodStats Total statistics regarding PUT operations
ServerHTTPStats.SuccessPUTStats ServerHTTPMethodStats Total statistics regarding successful PUT operations
ServerHTTPStats.TotalPOSTStats ServerHTTPMethodStats Total statistics regarding POST operations
ServerHTTPStats.SuccessPOSTStats ServerHTTPMethodStats Total statistics regarding successful POST operations
ServerHTTPStats.TotalDELETEStats ServerHTTPMethodStats Total statistics regarding DELETE operations
ServerHTTPStats.SuccessDELETEStats ServerHTTPMethodStats Total statistics regarding successful DELETE operations
Param Type Description
ServerHTTPMethodStats.Count uint64 Total number of operations.
ServerHTTPMethodStats.AvgDuration string Average duration of Count number of operations.
Param Type Description
Backend.Type BackendType Type of backend used by the server currently only FS or Erasure.
Backend.OnlineDisks int Total number of disks online (only applies to Erasure backend), is empty for FS.
Backend.OfflineDisks int Total number of disks offline (only applies to Erasure backend), is empty for FS.
Backend.StandardSCData int Data disks set for standard storage class, is empty for FS.
Backend.StandardSCParity int Parity disks set for standard storage class, is empty for FS.
Backend.RRSCData int Data disks set for reduced redundancy storage class, is empty for FS.
Backend.RRSCParity int Parity disks set for reduced redundancy storage class, is empty for FS.
Backend.Sets [][]DriveInfo Represents topology of drives in erasure coded sets.
Param Type Description
DriveInfo.UUID string Unique ID for each disk provisioned by server format.
DriveInfo.Endpoint string Endpoint location of the remote/local disk.
DriveInfo.State string Current state of the disk at endpoint.

Example


   serversInfo, err := madmClnt.ServerInfo()
   if err != nil {
   	log.Fatalln(err)
   }

   for _, peerInfo := range serversInfo {
   	log.Printf("Node: %s, Info: %v\n", peerInfo.Addr, peerInfo.Data)
   }

ServerDrivesPerfInfo() ([]ServerDrivesPerfInfo, error)

Fetches drive performance information for all cluster nodes. Returned value is in Bytes/s.

Param Type Description
di.Addr string Address of the server the following information is retrieved from.
di.Error string Errors (if any) encountered while reaching this node
di.DrivesPerf disk.Performance Path of the drive mount on above server and read, write speed.
Param Type Description
disk.Performance.Path string Path of drive mount.
disk.Performance.Error string Error (if any) encountered while accessing this drive.
disk.Performance.WriteSpeed float64 Write speed on above path in Bytes/s.
disk.Performance.ReadSpeed float64 Read speed on above path in Bytes/s.

ServerCPULoadInfo() ([]ServerCPULoadInfo, error)

Fetches CPU utilization for all cluster nodes. Returned value is in Bytes.

Param Type Description
cpui.Addr string Address of the server the following information is retrieved from.
cpui.Error string Errors (if any) encountered while reaching this node
cpui.CPULoad cpu.Load The load on the CPU.
Param Type Description
cpu.Load.Avg float64 The average utilization of the CPU measured in a 200ms interval
cpu.Load.Min float64 The minimum utilization of the CPU measured in a 200ms interval
cpu.Load.Max float64 The maximum utilization of the CPU measured in a 200ms interval
cpu.Load.Error string Error (if any) encountered while accesing the CPU info

ServerMemUsageInfo() ([]ServerMemUsageInfo, error)

Fetches Mem utilization for all cluster nodes. Returned value is in Bytes.

Param Type Description
memi.Addr string Address of the server the following information is retrieved from.
memi.Error string Errors (if any) encountered while reaching this node
memi.MemUsage mem.Usage The utilitzation of Memory
Param Type Description
mem.Usage.Mem uint64 The total number of bytes obtained from the OS
mem.Usage.Error string Error (if any) encountered while accesing the CPU info

6. Heal operations

Heal(bucket, prefix string, healOpts HealOpts, clientToken string, forceStart bool, forceStop bool) (start HealStartSuccess, status HealTaskStatus, err error)

Start a heal sequence that scans data under given (possible empty) bucket and prefix. The recursive bool turns on recursive traversal under the given path. dryRun does not mutate on-disk data, but performs data validation.

Two heal sequences on overlapping paths may not be initiated.

The progress of a heal should be followed using the same API Heal by providing the clientToken previously obtained from a Heal API. The server accumulates results of the heal traversal and waits for the client to receive and acknowledge them using the status request by providing clientToken.

Example


    opts := madmin.HealOpts{
            Recursive: true,
            DryRun:    false,
    }
    forceStart := false
    forceStop := false
    healPath, err := madmClnt.Heal("", "", opts, "", forceStart, forceStop)
    if err != nil {
        log.Fatalln(err)
    }
    log.Printf("Heal sequence started at %s", healPath)

HealStartSuccess structure
Param Type Description
s.ClientToken string A unique token for a successfully started heal operation, this token is used to request realtime progress of the heal operation.
s.ClientAddress string Address of the client which initiated the heal operation, the client address has the form "host:port".
s.StartTime time.Time Time when heal was initially started.
HealTaskStatus structure
Param Type Description
s.Summary string Short status of heal sequence
s.FailureDetail string Error message in case of heal sequence failure
s.HealSettings HealOpts Contains the booleans set in the HealStart call
s.Items []HealResultItem Heal records for actions performed by server
HealResultItem structure
Param Type Description
ResultIndex int64 Index of the heal-result record
Type HealItemType Represents kind of heal operation in the heal record
Bucket string Bucket name
Object string Object name
Detail string Details about heal operation
DiskInfo.AvailableOn []int List of disks on which the healed entity is present and healthy
DiskInfo.HealedOn []int List of disks on which the healed entity was restored

7. Config operations

GetConfig() ([]byte, error)

Get current config.json of a MinIO server.

Example

    configBytes, err := madmClnt.GetConfig()
    if err != nil {
        log.Fatalf("failed due to: %v", err)
    }

    // Pretty-print config received as json.
    var buf bytes.Buffer
    err = json.Indent(buf, configBytes, "", "\t")
    if err != nil {
        log.Fatalf("failed due to: %v", err)
    }

    log.Println("config received successfully: ", string(buf.Bytes()))

SetConfig(config io.Reader) error

Set a new config.json for a MinIO server.

Example

    config := bytes.NewReader([]byte(`config.json contents go here`))
    if err := madmClnt.SetConfig(config); err != nil {
        log.Fatalf("failed due to: %v", err)
    }
    log.Println("SetConfig was successful")

GetConfigKeys(keys []string) ([]byte, error)

Get a json document which contains a set of keys and their values from config.json.

Example

    configBytes, err := madmClnt.GetConfigKeys([]string{"version", "notify.amqp.1"})
    if err != nil {
        log.Fatalf("failed due to: %v", err)
    }

    // Pretty-print config received as json.
    var buf bytes.Buffer
    err = json.Indent(buf, configBytes, "", "\t")
    if err != nil {
        log.Fatalf("failed due to: %v", err)
    }

    log.Println("config received successfully: ", string(buf.Bytes()))

SetConfigKeys(params map[string]string) error

Set a set of keys and values for MinIO server or distributed setup and restart the MinIO server for the new configuration changes to take effect.

Example

    err := madmClnt.SetConfigKeys(map[string]string{"notify.webhook.1": "{\"enable\": true, \"endpoint\": \"http://example.com/api\"}"})
    if err != nil {
        log.Fatalf("failed due to: %v", err)
    }

    log.Println("New configuration successfully set")

8. Top operations

TopLocks() (LockEntries, error)

Get the oldest locks from MinIO server.

Example

    locks, err := madmClnt.TopLocks()
    if err != nil {
        log.Fatalf("failed due to: %v", err)
    }

    out, err := json.Marshal(locks)
    if err != nil {
        log.Fatalf("Marshal failed due to: %v", err)
    }

    log.Println("TopLocks received successfully: ", string(out))

9. IAM operations

AddCannedPolicy(policyName string, policy string) error

Create a new canned policy on MinIO server.

Example

	policy := `{"Version": "2012-10-17","Statement": [{"Action": ["s3:GetObject"],"Effect": "Allow","Resource": ["arn:aws:s3:::my-bucketname/*"],"Sid": ""}]}`

    if err = madmClnt.AddCannedPolicy("get-only", policy); err != nil {
		log.Fatalln(err)
	}

AddUser(user string, secret string) error

Add a new user on a MinIO server.

Example

	if err = madmClnt.AddUser("newuser", "newstrongpassword"); err != nil {
		log.Fatalln(err)
	}

SetUserPolicy(user string, policyName string) error

Enable a canned policy get-only for a given user on MinIO server.

Example

	if err = madmClnt.SetUserPolicy("newuser", "get-only"); err != nil {
		log.Fatalln(err)
	}

ListUsers() (map[string]UserInfo, error)

Lists all users on MinIO server.

Example

	users, err := madmClnt.ListUsers();
    if err != nil {
		log.Fatalln(err)
	}
    for k, v := range users {
        fmt.Printf("User %s Status %s\n", k, v.Status)
    }

10. Misc operations

StartProfiling(profiler string) error

Ask all nodes to start profiling using the specified profiler mode

Example

    startProfilingResults, err = madmClnt.StartProfiling("cpu")
    if err != nil {
            log.Fatalln(err)
    }
    for _, result := range startProfilingResults {
        if !result.Success {
            log.Printf("Unable to start profiling on node `%s`, reason = `%s`\n", result.NodeName, result.Error)
        } else {
            log.Printf("Profiling successfully started on node `%s`\n", result.NodeName)
        }
    }

DownloadProfilingData() ([]byte, error)

Download profiling data of all nodes in a zip format.

Example

    profilingData, err := madmClnt.DownloadProfilingData()
    if err != nil {
            log.Fatalln(err)
    }

    profilingFile, err := os.Create("/tmp/profiling-data.zip")
    if err != nil {
            log.Fatal(err)
    }

    if _, err := io.Copy(profilingFile, profilingData); err != nil {
            log.Fatal(err)
    }

    if err := profilingFile.Close(); err != nil {
            log.Fatal(err)
    }

    if err := profilingData.Close(); err != nil {
            log.Fatal(err)
    }

    log.Println("Profiling data successfully downloaded.")

Trace(allTrace bool,doneCh <-chan struct{}) <-chan TraceInfo

Enable HTTP request tracing on all nodes in a MinIO cluster

Example

    doneCh := make(chan struct{})
    defer close(doneCh)
    // listen to all trace including internal API calls
    allTrace := true
    // Start listening on all trace activity.
    traceCh := madmClnt.Trace(allTrace,doneCh)
    for traceInfo := range traceCh {
        fmt.Println(traceInfo.String())
    }
    log.Println("Success")

Documentation

Index

Constants

View Source
const (
	HealItemMetadata       HealItemType = "metadata"
	HealItemBucket                      = "bucket"
	HealItemBucketMetadata              = "bucket-metadata"
	HealItemObject                      = "object"
)

HealItemType constants

View Source
const (
	DriveStateOk      string = "ok"
	DriveStateOffline        = "offline"
	DriveStateCorrupt        = "corrupt"
	DriveStateMissing        = "missing"
)

Drive state constants

View Source
const (
	ProfilerCPU   ProfilerType = "cpu"   // represents CPU profiler type
	ProfilerMEM                = "mem"   // represents MEM profiler type
	ProfilerBlock              = "block" // represents Block profiler type
	ProfilerMutex              = "mutex" // represents Mutex profiler type
	ProfilerTrace              = "trace" // represents Trace profiler type
)

Different supported profiler types.

View Source
const DefaultRetryCap = time.Second * 30

DefaultRetryCap - Each retry attempt never waits no longer than this maximum time duration.

View Source
const DefaultRetryUnit = time.Second

DefaultRetryUnit - default unit multiplicative per retry. defaults to 1 second.

View Source
const MaxJitter = 1.0

MaxJitter will randomize over the full exponential backoff time

View Source
const NoJitter = 0.0

NoJitter disables the use of jitter for randomizing the exponential backoff time

Variables

View Source
var MaxRetry = 10

MaxRetry is the maximum number of retries before stopping.

Functions

func DecryptData

func DecryptData(password string, data io.Reader) ([]byte, error)

DecryptData - decrypts server config data.

func EncryptData

func EncryptData(password string, data []byte) ([]byte, error)

EncryptData - encrypts server config data.

func ErrInvalidArgument

func ErrInvalidArgument(message string) error

ErrInvalidArgument - Invalid argument response.

Types

type AccountStatus

type AccountStatus string

AccountStatus - account status.

const (
	AccountEnabled  AccountStatus = "enabled"
	AccountDisabled AccountStatus = "disabled"
)

Account status per user.

type AdminAPIVersionInfo

type AdminAPIVersionInfo struct {
	Version string `json:"version"`
}

AdminAPIVersionInfo - contains admin API version information

type AdminClient

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

AdminClient implements Amazon S3 compatible methods.

func New

func New(endpoint string, accessKeyID, secretAccessKey string, secure bool) (*AdminClient, error)

New - instantiate minio client Client, adds automatic verification of signature.

func (*AdminClient) AddCannedPolicy

func (adm *AdminClient) AddCannedPolicy(policyName, policy string) error

AddCannedPolicy - adds a policy for a canned.

func (*AdminClient) AddUser

func (adm *AdminClient) AddUser(accessKey, secretKey string) error

AddUser - adds a user.

func (*AdminClient) BackgroundHealStatus

func (adm *AdminClient) BackgroundHealStatus() (BgHealState, error)

BackgroundHealStatus returns the background heal status of the current server or cluster.

func (*AdminClient) DownloadProfilingData

func (adm *AdminClient) DownloadProfilingData() (io.ReadCloser, error)

DownloadProfilingData makes an admin call to download profiling data of a standalone server or of the whole cluster in case of a distributed setup.

func (*AdminClient) GetConfig

func (adm *AdminClient) GetConfig() ([]byte, error)

GetConfig - returns the config.json of a minio setup, incoming data is encrypted.

func (*AdminClient) GetConfigKeys

func (adm *AdminClient) GetConfigKeys(keys []string) ([]byte, error)

GetConfigKeys - returns partial json or json value from config.json of a minio setup.

func (*AdminClient) Heal

func (adm *AdminClient) Heal(bucket, prefix string, healOpts HealOpts,
	clientToken string, forceStart, forceStop bool) (
	healStart HealStartSuccess, healTaskStatus HealTaskStatus, err error)

Heal - API endpoint to start heal and to fetch status forceStart and forceStop are mutually exclusive, you can either set one of them to 'true'. If both are set 'forceStart' will be honored.

func (*AdminClient) ListCannedPolicies

func (adm *AdminClient) ListCannedPolicies() (map[string][]byte, error)

ListCannedPolicies - list all configured canned policies.

func (*AdminClient) ListUsers

func (adm *AdminClient) ListUsers() (map[string]UserInfo, error)

ListUsers - list all users.

func (*AdminClient) RemoveCannedPolicy

func (adm *AdminClient) RemoveCannedPolicy(policyName string) error

RemoveCannedPolicy - remove a policy for a canned.

func (*AdminClient) RemoveUser

func (adm *AdminClient) RemoveUser(accessKey string) error

RemoveUser - remove a user.

func (*AdminClient) ServerCPULoadInfo

func (adm *AdminClient) ServerCPULoadInfo() ([]ServerCPULoadInfo, error)

ServerCPULoadInfo - Returns cpu utilization information

func (*AdminClient) ServerDrivesPerfInfo

func (adm *AdminClient) ServerDrivesPerfInfo() ([]ServerDrivesPerfInfo, error)

ServerDrivesPerfInfo - Returns drive's read and write performance information

func (*AdminClient) ServerInfo

func (adm *AdminClient) ServerInfo() ([]ServerInfo, error)

ServerInfo - Connect to a minio server and call Server Info Management API to fetch server's information represented by ServerInfo structure

func (*AdminClient) ServerMemUsageInfo

func (adm *AdminClient) ServerMemUsageInfo() ([]ServerMemUsageInfo, error)

ServerMemUsageInfo - Returns mem utilization information

func (*AdminClient) ServiceSendAction

func (adm *AdminClient) ServiceSendAction(action ServiceActionValue) error

ServiceSendAction - Call Service Restart/Stop API to restart/stop a MinIO server

func (*AdminClient) ServiceStatus

func (adm *AdminClient) ServiceStatus() (ss ServiceStatus, err error)

ServiceStatus - Connect to a minio server and call Service Status Management API to fetch server's storage information represented by ServiceStatusMetadata structure

func (*AdminClient) SetAppInfo

func (adm *AdminClient) SetAppInfo(appName string, appVersion string)

SetAppInfo - add application details to user agent.

func (*AdminClient) SetConfig

func (adm *AdminClient) SetConfig(config io.Reader) (err error)

SetConfig - set config supplied as config.json for the setup.

func (*AdminClient) SetConfigKeys

func (adm *AdminClient) SetConfigKeys(params map[string]string) error

SetConfigKeys - set config keys supplied as config.json for the setup.

func (*AdminClient) SetCustomTransport

func (adm *AdminClient) SetCustomTransport(customHTTPTransport http.RoundTripper)

SetCustomTransport - set new custom transport.

func (*AdminClient) SetUser

func (adm *AdminClient) SetUser(accessKey, secretKey string, status AccountStatus) error

SetUser - sets a user info.

func (*AdminClient) SetUserPolicy

func (adm *AdminClient) SetUserPolicy(accessKey, policyName string) error

SetUserPolicy - adds a policy for a user.

func (*AdminClient) SetUserStatus

func (adm *AdminClient) SetUserStatus(accessKey string, status AccountStatus) error

SetUserStatus - adds a status for a user.

func (*AdminClient) StartProfiling

func (adm *AdminClient) StartProfiling(profiler ProfilerType) ([]StartProfilingResult, error)

StartProfiling makes an admin call to remotely start profiling on a standalone server or the whole cluster in case of a distributed setup.

func (*AdminClient) TopLocks

func (adm *AdminClient) TopLocks() (LockEntries, error)

TopLocks - returns the oldest locks in a minio setup.

func (AdminClient) Trace

func (adm AdminClient) Trace(allTrace, errTrace bool, doneCh <-chan struct{}) <-chan TraceInfo

Trace - listen on http trace notifications.

func (*AdminClient) TraceOff

func (adm *AdminClient) TraceOff()

TraceOff - disable HTTP tracing.

func (*AdminClient) TraceOn

func (adm *AdminClient) TraceOn(outputStream io.Writer)

TraceOn - enable HTTP tracing.

func (*AdminClient) VersionInfo

func (adm *AdminClient) VersionInfo() (verInfo AdminAPIVersionInfo, err error)

VersionInfo - Connect to minio server and call the version API to retrieve the server API version

type BackendType

type BackendType int

BackendType - represents different backend types.

const (
	Unknown BackendType = iota
	// Filesystem backend.
	FS
	// Multi disk Erasure (single, distributed) backend.
	Erasure
)

Enum for different backend types.

type BgHealState

type BgHealState struct {
	ScannedItemsCount int64
	LastHealActivity  time.Time
}

BgHealState represents the status of the background heal

type DriveInfo

type DriveInfo HealDriveInfo

DriveInfo - represents each drive info, describing status, uuid and endpoint.

type ErrorResponse

type ErrorResponse struct {
	XMLName    xml.Name `xml:"Error" json:"-"`
	Code       string
	Message    string
	BucketName string
	Key        string
	RequestID  string `xml:"RequestId"`
	HostID     string `xml:"HostId"`

	// Region where the bucket is located. This header is returned
	// only in HEAD bucket and ListObjects response.
	Region string
}

ErrorResponse - Is the typed error returned by all API operations.

func ToErrorResponse

func ToErrorResponse(err error) ErrorResponse

ToErrorResponse - Returns parsed ErrorResponse struct from body and http headers.

For example:

import admin "github.com/minio/minio/pkg/madmin"
...
...
ss, err := adm.ServiceStatus(...)
if err != nil {
   resp := admin.ToErrorResponse(err)
}
...

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

Error - Returns HTTP error string

type HealDriveInfo

type HealDriveInfo struct {
	UUID     string `json:"uuid"`
	Endpoint string `json:"endpoint"`
	State    string `json:"state"`
}

HealDriveInfo - struct for an individual drive info item.

type HealItemType

type HealItemType string

HealItemType - specify the type of heal operation in a healing result

type HealOpts

type HealOpts struct {
	Recursive bool         `json:"recursive"`
	DryRun    bool         `json:"dryRun"`
	Remove    bool         `json:"remove"`
	ScanMode  HealScanMode `json:"scanMode"`
}

HealOpts - collection of options for a heal sequence

type HealResultItem

type HealResultItem struct {
	ResultIndex  int64        `json:"resultId"`
	Type         HealItemType `json:"type"`
	Bucket       string       `json:"bucket"`
	Object       string       `json:"object"`
	Detail       string       `json:"detail"`
	ParityBlocks int          `json:"parityBlocks,omitempty"`
	DataBlocks   int          `json:"dataBlocks,omitempty"`
	DiskCount    int          `json:"diskCount"`
	SetCount     int          `json:"setCount"`
	// below slices are from drive info.
	Before struct {
		Drives []HealDriveInfo `json:"drives"`
	} `json:"before"`
	After struct {
		Drives []HealDriveInfo `json:"drives"`
	} `json:"after"`
	ObjectSize int64 `json:"objectSize"`
}

HealResultItem - struct for an individual heal result item

func (*HealResultItem) GetCorruptedCounts

func (hri *HealResultItem) GetCorruptedCounts() (b, a int)

GetCorruptedCounts - returns the number of corrupted disks before and after heal

func (*HealResultItem) GetMissingCounts

func (hri *HealResultItem) GetMissingCounts() (b, a int)

GetMissingCounts - returns the number of missing disks before and after heal

func (*HealResultItem) GetOfflineCounts

func (hri *HealResultItem) GetOfflineCounts() (b, a int)

GetOfflineCounts - returns the number of offline disks before and after heal

func (*HealResultItem) GetOnlineCounts

func (hri *HealResultItem) GetOnlineCounts() (b, a int)

GetOnlineCounts - returns the number of online disks before and after heal

type HealScanMode

type HealScanMode int

HealScanMode represents the type of healing scan

const (
	// HealNormalScan checks if parts are present and not outdated
	HealNormalScan HealScanMode = iota
	// HealDeepScan checks for parts bitrot checksums
	HealDeepScan
)

type HealStartSuccess

type HealStartSuccess struct {
	ClientToken   string    `json:"clientToken"`
	ClientAddress string    `json:"clientAddress"`
	StartTime     time.Time `json:"startTime"`
}

HealStartSuccess - holds information about a successfully started heal operation

type HealStopSuccess

type HealStopSuccess HealStartSuccess

HealStopSuccess - holds information about a successfully stopped heal operation.

type HealTaskStatus

type HealTaskStatus struct {
	Summary       string    `json:"summary"`
	FailureDetail string    `json:"detail"`
	StartTime     time.Time `json:"startTime"`
	HealSettings  HealOpts  `json:"settings"`
	NumDisks      int       `json:"numDisks"`

	Items []HealResultItem `json:"items,omitempty"`
}

HealTaskStatus - status struct for a heal task

type LockEntries

type LockEntries []LockEntry

LockEntries - To sort the locks

func (LockEntries) Len

func (l LockEntries) Len() int

func (LockEntries) Less

func (l LockEntries) Less(i, j int) bool

func (LockEntries) Swap

func (l LockEntries) Swap(i, j int)

type LockEntry

type LockEntry struct {
	Timestamp  time.Time `json:"time"`       // Timestamp set at the time of initialization.
	Resource   string    `json:"resource"`   // Resource contains info like bucket, object etc
	Type       string    `json:"type"`       // Bool whether write or read lock.
	Source     string    `json:"source"`     // Source which created the lock
	ServerList []string  `json:"serverlist"` // RPC path of servers issuing the lock.
	Owner      string    `json:"owner"`      // RPC path of client claiming lock.
	ID         string    `json:"id"`         // UID to uniquely identify request of client.
}

LockEntry holds information about client requesting the lock, servers holding the lock, source on the client machine, ID, type(read or write) and time stamp.

type ProfilerType

type ProfilerType string

ProfilerType represents the profiler type passed to the profiler subsystem.

type ServerCPULoadInfo

type ServerCPULoadInfo struct {
	Addr         string     `json:"addr"`
	Error        string     `json:"error,omitempty"`
	Load         []cpu.Load `json:"load"`
	HistoricLoad []cpu.Load `json:"historicLoad"`
}

ServerCPULoadInfo holds information about address and cpu load of a single server node

type ServerConnStats

type ServerConnStats struct {
	TotalInputBytes  uint64 `json:"transferred"`
	TotalOutputBytes uint64 `json:"received"`
}

ServerConnStats holds network information

type ServerDrivesPerfInfo

type ServerDrivesPerfInfo struct {
	Addr  string             `json:"addr"`
	Error string             `json:"error,omitempty"`
	Perf  []disk.Performance `json:"perf"`
}

ServerDrivesPerfInfo holds informantion about address and write speed of all drives in a single server node

type ServerHTTPMethodStats

type ServerHTTPMethodStats struct {
	Count       uint64 `json:"count"`
	AvgDuration string `json:"avgDuration"`
}

ServerHTTPMethodStats holds total number of HTTP operations from/to the server, including the average duration the call was spent.

type ServerHTTPStats

type ServerHTTPStats struct {
	TotalHEADStats     ServerHTTPMethodStats `json:"totalHEADs"`
	SuccessHEADStats   ServerHTTPMethodStats `json:"successHEADs"`
	TotalGETStats      ServerHTTPMethodStats `json:"totalGETs"`
	SuccessGETStats    ServerHTTPMethodStats `json:"successGETs"`
	TotalPUTStats      ServerHTTPMethodStats `json:"totalPUTs"`
	SuccessPUTStats    ServerHTTPMethodStats `json:"successPUTs"`
	TotalPOSTStats     ServerHTTPMethodStats `json:"totalPOSTs"`
	SuccessPOSTStats   ServerHTTPMethodStats `json:"successPOSTs"`
	TotalDELETEStats   ServerHTTPMethodStats `json:"totalDELETEs"`
	SuccessDELETEStats ServerHTTPMethodStats `json:"successDELETEs"`
}

ServerHTTPStats holds all type of http operations performed to/from the server including their average execution time.

type ServerInfo

type ServerInfo struct {
	Error string          `json:"error"`
	Addr  string          `json:"addr"`
	Data  *ServerInfoData `json:"data"`
}

ServerInfo holds server information result of one node

type ServerInfoData

type ServerInfoData struct {
	StorageInfo StorageInfo      `json:"storage"`
	ConnStats   ServerConnStats  `json:"network"`
	HTTPStats   ServerHTTPStats  `json:"http"`
	Properties  ServerProperties `json:"server"`
}

ServerInfoData holds storage, connections and other information of a given server

type ServerMemUsageInfo

type ServerMemUsageInfo struct {
	Addr          string      `json:"addr"`
	Error         string      `json:"error,omitempty"`
	Usage         []mem.Usage `json:"usage"`
	HistoricUsage []mem.Usage `json:"historicUsage"`
}

ServerMemUsageInfo holds information about address and memory utilization of a single server node

type ServerProperties

type ServerProperties struct {
	Uptime       time.Duration `json:"uptime"`
	Version      string        `json:"version"`
	CommitID     string        `json:"commitID"`
	DeploymentID string        `json:"deploymentID"`
	Region       string        `json:"region"`
	SQSARN       []string      `json:"sqsARN"`
}

ServerProperties holds some of the server's information such as uptime, version, region, ..

type ServerVersion

type ServerVersion struct {
	Version  string `json:"version"`
	CommitID string `json:"commitID"`
}

ServerVersion - server version

type ServiceAction

type ServiceAction struct {
	Action ServiceActionValue `json:"action"`
}

ServiceAction - represents POST body for service action APIs

type ServiceActionValue

type ServiceActionValue string

ServiceActionValue - type to restrict service-action values

const (
	// ServiceActionValueRestart represents restart action
	ServiceActionValueRestart ServiceActionValue = "restart"
	// ServiceActionValueStop represents stop action
	ServiceActionValueStop = "stop"
)

type ServiceStatus

type ServiceStatus struct {
	ServerVersion ServerVersion `json:"serverVersion"`
	Uptime        time.Duration `json:"uptime"`
}

ServiceStatus - contains the response of service status API

type StartProfilingResult

type StartProfilingResult struct {
	NodeName string `json:"nodeName"`
	Success  bool   `json:"success"`
	Error    string `json:"error"`
}

StartProfilingResult holds the result of starting profiler result in a given node.

type StorageInfo

type StorageInfo struct {
	Used uint64 // Total used spaced per tenant.

	Available uint64 // Total available space.

	Total uint64 // Total disk space.

	// Backend type.
	Backend struct {
		// Represents various backend types, currently on FS and Erasure.
		Type BackendType

		// Following fields are only meaningful if BackendType is Erasure.
		OnlineDisks      int // Online disks during server startup.
		OfflineDisks     int // Offline disks during server startup.
		StandardSCData   int // Data disks for currently configured Standard storage class.
		StandardSCParity int // Parity disks for currently configured Standard storage class.
		RRSCData         int // Data disks for currently configured Reduced Redundancy storage class.
		RRSCParity       int // Parity disks for currently configured Reduced Redundancy storage class.

		// List of all disk status, this is only meaningful if BackendType is Erasure.
		Sets [][]DriveInfo
	}
}

StorageInfo - represents total capacity of underlying storage.

type TraceInfo

type TraceInfo struct {
	Trace trace.Info
	Err   error `json:"-"`
}

TraceInfo holds http trace

type UserInfo

type UserInfo struct {
	SecretKey  string        `json:"secretKey,omitempty"`
	PolicyName string        `json:"policyName,omitempty"`
	Status     AccountStatus `json:"status"`
}

UserInfo carries information about long term users.

Jump to

Keyboard shortcuts

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