api

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2014 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HEAD            = "HEAD"
	PUT             = "PUT"
	POST            = "POST"
	GET             = "GET"
	DELETE          = "DELETE"
	JSONCONTENTTYPE = "application/json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveTask

type ActiveTask struct {
	Type           string
	Pid            string
	Database       Database
	Progress       int
	DesignDocument DesignDoc `json:"design_document"`
	StartedOn      int       `json:"started_on"`
	Source         string
	Target         string
	Continuous     bool
}

func (ActiveTask) PP

func (a ActiveTask) PP(printer util.Printer)

type ActiveTasks

type ActiveTasks []ActiveTask

func (*ActiveTasks) ByType

func (a *ActiveTasks) ByType(t string) ActiveTasks

func (ActiveTasks) PP

func (a ActiveTasks) PP(printer util.Printer)

type Couchdb

type Couchdb struct {
	ResultHandler func(*Result)
	// contains filtered or unexported fields
}

func New

func New(host string) (*Couchdb, error)

func (Couchdb) DeleteAllReplicators

func (c Couchdb) DeleteAllReplicators() (*Replicators, error)

func (Couchdb) DeleteReplicator

func (c Couchdb) DeleteReplicator(id string) error

func (*Couchdb) GetActiveTasks

func (c *Couchdb) GetActiveTasks() (ActiveTasks, error)

func (Couchdb) GetDatabases

func (c Couchdb) GetDatabases() (Databases, error)

func (Couchdb) GetReplicator

func (c Couchdb) GetReplicator(id string) (*Replicator, error)

func (Couchdb) GetReplicators

func (c Couchdb) GetReplicators() (*Replicators, error)

func (Couchdb) GetServer

func (c Couchdb) GetServer() (Server, error)

func (Couchdb) GetSession

func (c Couchdb) GetSession() (Session, error)

func (Couchdb) GetStats

func (c Couchdb) GetStats(sectionA, sectionB string) (Stats, error)

func (Couchdb) GetViews

func (c Couchdb) GetViews(db Database) (Views, error)

func (Couchdb) RefreshView

func (c Couchdb) RefreshView(view View) error

func (Couchdb) RefreshViews

func (c Couchdb) RefreshViews(views Views) (Views, []error)

func (Couchdb) Replicate

func (c Couchdb) Replicate(conf ReplicationConfig) error

func (Couchdb) ReplicateHost

func (c Couchdb) ReplicateHost(remoteCouch *Couchdb, conf ReplicationConfig) (*Databases, error)

type CouchdbError

type CouchdbError struct {
	ErrorMsg string `json:"error"`
	Status   int
	Reason   string
}

func (CouchdbError) Error

func (e CouchdbError) Error() string

func (CouchdbError) IsConflict

func (e CouchdbError) IsConflict() bool

func (CouchdbError) IsNotFound

func (e CouchdbError) IsNotFound() bool

type Database

type Database struct {
	Name *string
}

func (Database) PP

func (d Database) PP(printer util.Printer)

func (*Database) String

func (d *Database) String() string

func (*Database) URL added in v0.0.2

func (d *Database) URL() string

func (*Database) UnmarshalJSON

func (d *Database) UnmarshalJSON(data []byte) error

type Databases

type Databases []Database

func (Databases) PP

func (d Databases) PP(printer util.Printer)

type DesignDoc

type DesignDoc struct {
	Database Database
	ID       string
}

func (DesignDoc) PP

func (d DesignDoc) PP(printer util.Printer)

func (DesignDoc) String

func (d DesignDoc) String() string

func (*DesignDoc) UnmarshalJSON

func (d *DesignDoc) UnmarshalJSON(data []byte) error

type ReplicationConfig

type ReplicationConfig struct {
	ID           string  `json:"_id,omitempty"`
	REV          string  `json:"_rev,omitempty"`
	Source       string  `json:"source"`
	Target       string  `json:"target"`
	Cancel       bool    `json:"cancel"`
	CreateTarget bool    `json:"create_target"`
	Continuous   bool    `json:"continuous"`
	UserCtx      UserCtx `json:"user_ctx"` // see api/session
}

func (*ReplicationConfig) GenerateId

func (r *ReplicationConfig) GenerateId()

type Replicator

type Replicator struct {
	ReplicationConfig
	// following fields are set after doc creation
	Owner                string `json:"owner,omitempty"`
	ReplicationId        string `json:"_replication_id,omitempty"`
	ReplicationState     string `json:"_replication_state,omitempty"`
	ReplicationStateTime string `json:"_replication_state_time,omitempty"`
}

func (Replicator) PP

func (r Replicator) PP(printer util.Printer)

type Replicators

type Replicators map[string][]*Replicator

func (Replicators) PP

func (r Replicators) PP(printer util.Printer)

type Result

type Result struct {
	Path       string
	Method     string
	StatusCode int
}

func (Result) PP

func (r Result) PP(printer util.Printer)

type Server

type Server struct {
	Couchdb string
	Uuid    string
	Vendor  struct {
		Name    string
		Version string
	}
	Version string
}

func (Server) PP

func (s Server) PP(printer util.Printer)

func (*Server) String

func (s *Server) String() string

type Session

type Session struct {
	OK      bool                   `json:"ok"`
	UserCtx UserCtx                `json:"userCtx"`
	Info    map[string]interface{} `json:"info"`
}

func (Session) PP

func (s Session) PP(printer util.Printer)

type Stat

type Stat struct {
	Description string
	Current     float64
	Sum         float64
	Mean        float64
	Min         float64
	Max         float64
	Stddev      float64
	Section     string
	SubSection  string
}

func (Stat) PP

func (s Stat) PP(printer util.Printer)

func (Stat) TrimmedDescription

func (s Stat) TrimmedDescription() string

type Stats

type Stats []Stat

func (Stats) PP

func (s Stats) PP(printer util.Printer)

type UserCtx

type UserCtx struct {
	Name  string   `json:"name,omitempty"`
	Roles []string `json:"roles"`
}

type View

type View struct {
	Database  Database
	DesignDoc DesignDoc
	Name      string
}

func (View) PP

func (v View) PP(printer util.Printer)

func (View) String

func (v View) String() string

type Views

type Views map[DesignDoc][]View

func (Views) PP

func (v Views) PP(printer util.Printer)

Jump to

Keyboard shortcuts

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