cmd

package
v0.0.0-...-1e16ed5 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2016 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Overview

Package cmd contains all the global variables and constants. ONLY TO BE ACCESSED VIA GET/SET FUNCTIONS.

Package cmd - session V8 - Version 8 stores session header and session data in two separate files. Session data contains fully prepared URL list.

Package cmd - This file implements a simple trie tree to be used for 'mc' cli commands.

Index

Constants

View Source
const Day = 24 * time.Hour

Day time.Duration for day.

Variables

View Source
var (
	// Version - version time.RFC3339.
	Version = "DEVELOPMENT.GOGET"
	// ReleaseTag - release tag in TAG.%Y-%m-%dT%H-%M-%SZ.
	ReleaseTag = "DEVELOPMENT.GOGET"
	// CommitID - latest commit id.
	CommitID = "DEVELOPMENT.GOGET"
	// ShortCommitID - first 12 characters from CommitID.
	ShortCommitID = CommitID[:12]
)
View Source
var (
	// EventTypePut contains the notify events that will cause a put
	EventTypePut = []notify.Event{notify.InCloseWrite | notify.InMovedTo}
	// EventTypeDelete contains the notify events that will cause a delete
	EventTypeDelete = []notify.Event{notify.InDelete | notify.InDeleteSelf | notify.InMovedFrom}
)
View Source
var ErrObjectAlreadyQueued = fmt.Errorf("Object already queued")

ErrObjectAlreadyQueued occurs when the object being pushed already exists in the queue

Functions

func DamerauLevenshteinDistance

func DamerauLevenshteinDistance(a string, b string) int

DamerauLevenshteinDistance calculates distance between two strings using an algorithm described in https://en.wikipedia.org/wiki/Damerau-Levenshtein_distance

func IsDeleteEvent

func IsDeleteEvent(event notify.Event) bool

IsDeleteEvent checks if the event returned is a delete event

func IsPutEvent

func IsPutEvent(event notify.Event) bool

IsPutEvent checks if the event returned is a put event

func Main

func Main()

Main starts mc application

Types

type APINotImplemented

type APINotImplemented struct {
	API     string
	APIType string
}

APINotImplemented - api not implemented

func (APINotImplemented) Error

func (e APINotImplemented) Error() string
type BrokenSymlink GenericFileError

BrokenSymlink (ENOTENT) - file has broken symlink.

func (BrokenSymlink) Error

func (e BrokenSymlink) Error() string

type BucketDoesNotExist

type BucketDoesNotExist GenericBucketError

BucketDoesNotExist - bucket does not exist.

func (BucketDoesNotExist) Error

func (e BucketDoesNotExist) Error() string

type BucketExists

type BucketExists GenericBucketError

BucketExists - bucket exists.

func (BucketExists) Error

func (e BucketExists) Error() string

type BucketInvalid

type BucketInvalid struct {
	Bucket string
}

BucketInvalid - bucket name invalid.

func (BucketInvalid) Error

func (e BucketInvalid) Error() string

type BucketNameEmpty

type BucketNameEmpty struct{}

BucketNameEmpty - bucket name empty (http://goo.gl/wJlzDz)

func (BucketNameEmpty) Error

func (e BucketNameEmpty) Error() string

type BucketNameTopLevel

type BucketNameTopLevel struct{}

BucketNameTopLevel - generic error

func (BucketNameTopLevel) Error

func (e BucketNameTopLevel) Error() string

type Client

type Client interface {
	// Common operations
	Stat(isIncomplete bool) (content *clientContent, err *probe.Error)
	List(isRecursive, isIncomplete bool, showDir DirOpt) <-chan *clientContent

	// Bucket operations
	MakeBucket(region string) *probe.Error

	// Access policy operations.
	GetAccess() (access string, error *probe.Error)
	GetAccessRules() (policyRules map[string]string, error *probe.Error)
	SetAccess(access string) *probe.Error

	// I/O operations
	Copy(source string, size int64, progress io.Reader) *probe.Error

	// I/O operations with metadata.
	Get() (reader io.Reader, metadata map[string][]string, err *probe.Error)
	Put(reader io.Reader, size int64, metadata map[string][]string, progress io.Reader) (n int64, err *probe.Error)

	// I/O operations with expiration
	ShareDownload(expires time.Duration) (string, *probe.Error)
	ShareUpload(bool, time.Duration, string) (string, map[string]string, *probe.Error)

	// Watch events
	Watch(params watchParams) (*watchObject, *probe.Error)

	// Delete operations
	Remove(isIncomplete bool, contentCh <-chan *clientContent) (errorCh <-chan *probe.Error)

	// GetURL returns back internal url
	GetURL() clientURL
}

Client - client interface

type Comparer

type Comparer interface {
	Equal(interface{}) bool
}

Comparer is an interface for queued objects, used to identify duplicate objects in queue.

type Config

type Config struct {
	AccessKey   string
	SecretKey   string
	Signature   string
	HostURL     string
	AppName     string
	AppVersion  string
	AppComments []string
	Debug       bool
	Insecure    bool
}

Config - see http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html

type DirOpt

type DirOpt int8

DirOpt - list directory option.

const (
	// DirNone - do not include directories in the list.
	DirNone DirOpt = iota
	// DirFirst - include directories before objects in the list.
	DirFirst
	// DirLast - include directories after objects in the list.
	DirLast
)

type DummyStatus

type DummyStatus struct{}

DummyStatus will not show anything.

func (*DummyStatus) Add

func (ds *DummyStatus) Add(v int64) Status

Add bytes to current number of bytes

func (*DummyStatus) Finish

func (ds *DummyStatus) Finish()

Finish displays the accounting summary

func (*DummyStatus) PrintMsg

func (ds *DummyStatus) PrintMsg(msg message)

PrintMsg prints message

func (*DummyStatus) Println

func (ds *DummyStatus) Println(data ...interface{})

Println prints line, ignored for quietstatus

func (*DummyStatus) Read

func (ds *DummyStatus) Read(p []byte) (n int, err error)

Read implements the io.Reader interface

func (*DummyStatus) SetCaption

func (ds *DummyStatus) SetCaption(s string)

SetCaption sets the caption of the progressbar, ignored for quietstatus

func (*DummyStatus) SetTotal

func (ds *DummyStatus) SetTotal(v int64) Status

SetTotal sets the total of the progressbar, ignored for quietstatus

func (*DummyStatus) Start

func (ds *DummyStatus) Start()

Start is ignored for quietstatus

func (*DummyStatus) Total

func (ds *DummyStatus) Total() int64

Total returns the total number of bytes

func (*DummyStatus) Update

func (ds *DummyStatus) Update()

Update is ignored for quietstatus

type EmptyPath

type EmptyPath struct{}

EmptyPath (EINVAL) - invalid argument.

func (EmptyPath) Error

func (e EmptyPath) Error() string

type Event

type Event struct {
	Time   string    `json:"time"`
	Size   int64     `json:"size"`
	Path   string    `json:"path"`
	Client Client    `json:"-"`
	Type   EventType `json:"type"`
}

Event contains the information of the event that occurred

type EventType

type EventType string

EventType is the type of the event that occurred

const (
	// EventCreate notifies when a new object has been created
	EventCreate EventType = "ObjectCreated"
	// EventRemove notifies when a new object has been deleted
	EventRemove = "ObjectRemoved"
)

type GenericBucketError

type GenericBucketError struct {
	Bucket string
}

GenericBucketError - generic bucket operations error

type GenericFileError

type GenericFileError struct {
	Path string
}

GenericFileError - generic file error.

type ObjectAlreadyExists

type ObjectAlreadyExists struct {
	Object string
}

ObjectAlreadyExists - typed return for MethodNotAllowed

func (ObjectAlreadyExists) Error

func (e ObjectAlreadyExists) Error() string

type ObjectAlreadyExistsAsDirectory

type ObjectAlreadyExistsAsDirectory struct {
	Object string
}

ObjectAlreadyExistsAsDirectory - typed return for XMinioObjectExistsAsDirectory

func (ObjectAlreadyExistsAsDirectory) Error

type ObjectMissing

type ObjectMissing struct{}

ObjectMissing (EINVAL) - object key missing.

func (ObjectMissing) Error

func (e ObjectMissing) Error() string

type ObjectOnGlacier

type ObjectOnGlacier struct {
	Object string
}

ObjectOnGlacier - object is of storage class glacier.

func (ObjectOnGlacier) Error

func (e ObjectOnGlacier) Error() string

type PathInsufficientPermission

type PathInsufficientPermission GenericFileError

PathInsufficientPermission (EPERM) - permission denied.

func (PathInsufficientPermission) Error

type PathIsNotRegular

type PathIsNotRegular GenericFileError

PathIsNotRegular (ENOTREG) - file is not a regular file.

func (PathIsNotRegular) Error

func (e PathIsNotRegular) Error() string

type PathNotFound

type PathNotFound GenericFileError

PathNotFound (ENOENT) - file not found.

func (PathNotFound) Error

func (e PathNotFound) Error() string

type ProgressStatus

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

ProgressStatus shows a progressbar

func (*ProgressStatus) Add

func (ps *ProgressStatus) Add(v int64) Status

Add bytes to current number of bytes

func (*ProgressStatus) Finish

func (ps *ProgressStatus) Finish()

Finish displays the accounting summary

func (*ProgressStatus) PrintMsg

func (ps *ProgressStatus) PrintMsg(msg message)

PrintMsg prints message

func (*ProgressStatus) Println

func (ps *ProgressStatus) Println(data ...interface{})

Println prints line, ignored for quietstatus

func (*ProgressStatus) Read

func (ps *ProgressStatus) Read(p []byte) (n int, err error)

Read implements the io.Reader interface

func (ProgressStatus) Set64

func (p ProgressStatus) Set64(length int64) *progressBar

func (*ProgressStatus) SetCaption

func (ps *ProgressStatus) SetCaption(s string)

SetCaption sets the caption of the progressbar

func (*ProgressStatus) SetTotal

func (ps *ProgressStatus) SetTotal(v int64) Status

SetTotal sets the total of the progressbar

func (*ProgressStatus) Start

func (ps *ProgressStatus) Start()

Start is ignored for quietstatus

func (*ProgressStatus) Total

func (ps *ProgressStatus) Total() int64

Total returns the total number of bytes

func (*ProgressStatus) Update

func (ps *ProgressStatus) Update()

Update is ignored for quietstatus

type Queue

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

Queue allows objects to be queued on a first in first out base.

func NewQueue

func NewQueue() *Queue

NewQueue creates a new queue

func (*Queue) Close

func (q *Queue) Close()

Close and disable the queue

func (*Queue) Count

func (q *Queue) Count() int

Count returns the number of items in the queue

func (*Queue) Pop

func (q *Queue) Pop() interface{}

Pop the first object on the queue

func (*Queue) Push

func (q *Queue) Push(u interface{}) error

Push a new object to the queue

func (*Queue) Save

func (q *Queue) Save(dst io.Writer) error

Save writes the current queue content to the writer

func (*Queue) Wait

func (q *Queue) Wait() error

Wait for items to become available

type QuietStatus

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

QuietStatus will only show the progress and summary

func (*QuietStatus) Add

func (qs *QuietStatus) Add(v int64) Status

Add bytes to current number of bytes

func (*QuietStatus) Finish

func (qs *QuietStatus) Finish()

Finish displays the accounting summary

func (*QuietStatus) PrintMsg

func (qs *QuietStatus) PrintMsg(msg message)

PrintMsg prints message

func (*QuietStatus) Println

func (qs *QuietStatus) Println(data ...interface{})

Println prints line, ignored for quietstatus

func (*QuietStatus) Read

func (qs *QuietStatus) Read(p []byte) (n int, err error)

Read implements the io.Reader interface

func (QuietStatus) Set

func (a QuietStatus) Set(n int64) *accounter

Set sets the current value atomically.

func (*QuietStatus) SetCaption

func (qs *QuietStatus) SetCaption(s string)

SetCaption sets the caption of the progressbar, ignored for quietstatus

func (*QuietStatus) SetTotal

func (qs *QuietStatus) SetTotal(v int64) Status

SetTotal sets the total of the progressbar, ignored for quietstatus

func (*QuietStatus) Start

func (qs *QuietStatus) Start()

Start is ignored for quietstatus

func (QuietStatus) Stat

func (a QuietStatus) Stat() accountStat

Stat provides current stats captured.

func (*QuietStatus) Total

func (qs *QuietStatus) Total() int64

Total returns the total number of bytes

func (*QuietStatus) Update

func (qs *QuietStatus) Update()

Update is ignored for quietstatus

type Status

type Status interface {
	Println(data ...interface{})
	Add(int64) Status
	Start()
	Finish()

	PrintMsg(msg message)

	Update()
	Total() int64
	SetTotal(int64) Status
	SetCaption(string)

	Read(p []byte) (n int, err error)
	// contains filtered or unexported methods
}

Status implements a interface that can be used in quit mode or with progressbar.

func NewDummyStatus

func NewDummyStatus() Status

NewDummyStatus returns a dummy status object

func NewProgressStatus

func NewProgressStatus() Status

NewProgressStatus returns a progress status object

func NewQuietStatus

func NewQuietStatus() Status

NewQuietStatus returns a quiet status object

type TooManyLevelsSymlink GenericFileError

TooManyLevelsSymlink (ELOOP) - file has too many levels of symlinks.

func (TooManyLevelsSymlink) Error

func (e TooManyLevelsSymlink) Error() string

type Trie

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

Trie is a trie container.

func (*Trie) Insert

func (t *Trie) Insert(key string)

Insert insert a key.

func (*Trie) PrefixMatch

func (t *Trie) PrefixMatch(key string) []interface{}

PrefixMatch - prefix match.

type URLs

type URLs struct {
	SourceAlias   string
	SourceContent *clientContent
	TargetAlias   string
	TargetContent *clientContent
	TotalCount    int64
	TotalSize     int64
	Error         *probe.Error `json:"-"`
}

URLs contains source and target urls

func (URLs) Equal

func (m URLs) Equal(n URLs) bool

Equal tests if both urls are equal

func (URLs) WithError

func (m URLs) WithError(err *probe.Error) URLs

WithError sets the error and returns object

type UnexpectedEOF

type UnexpectedEOF struct {
	TotalSize    int64
	TotalWritten int64
}

UnexpectedEOF (EPIPE) - reader closed prematurely.

func (UnexpectedEOF) Error

func (e UnexpectedEOF) Error() string

type UnexpectedExcessRead

type UnexpectedExcessRead UnexpectedEOF

UnexpectedExcessRead - reader wrote more data than requested.

func (UnexpectedExcessRead) Error

func (e UnexpectedExcessRead) Error() string

type UnexpectedShortWrite

type UnexpectedShortWrite struct {
	InputSize int
	WriteSize int
}

UnexpectedShortWrite - write wrote less bytes than expected.

func (UnexpectedShortWrite) Error

func (e UnexpectedShortWrite) Error() string

type Watcher

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

Watcher can be used to have one or multiple clients watch for notifications

func NewWatcher

func NewWatcher(sessionStartTime time.Time) *Watcher

NewWatcher creates a new watcher

func (*Watcher) Errors

func (w *Watcher) Errors() chan *probe.Error

Errors returns a channel which will receive errors

func (*Watcher) Events

func (w *Watcher) Events() chan Event

Events returns a channel which will receive events

func (*Watcher) Join

func (w *Watcher) Join(client Client, recursive bool) *probe.Error

Join the watcher with client

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop watcher

func (*Watcher) Wait

func (w *Watcher) Wait()

Wait for watcher to wait

func (*Watcher) Watching

func (w *Watcher) Watching() bool

Watching returns if the watcher is watching for notifications

Jump to

Keyboard shortcuts

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