诺志
软硬件开发技术笔记
docker使用volplugin对接存储-(4)梳理volplugin项目的包结构
2017-10-18
package: api
    files: 
           /api/api.go
           /api/handlers.go
           /api/interfaces.go
    structs: 
           type Volume struct {
                Mountpoint string
                Policy     string
                Name       string
                Options    map[string]string
           }
           type API struct {
                Volplugin
                Hostname          string
                Client            *config.Client
                Global            **config.Global 
                Lock              *lock.Driver
                lockStopChanMutex sync.Mutex
                lockStopChans     map[string]chan struct{}
                MountCounter      *mount.Counter
                MountCollection   *mount.Collection
           }
           type mountState struct {
                w          http.ResponseWriter
                err        error
                ut         *config.UseMount
                driver     storage.MountDriver
                driverOpts storage.DriverOptions
                volConfig  *config.Volume
           }
    interfaces: 
           type HTTP interface {
                Router(*API) *mux.Router
                HTTPError(http.ResponseWriter, error) 
           }
           type Volplugin interface {
                HTTP
                ReadCreate(*http.Request) (*config.VolumeRequest, error)
                WriteCreate(*config.Volume, http.ResponseWriter) error
                ReadGet(*http.Request) (string, error)
                WriteGet(string, string, http.ResponseWriter) error
                ReadPath(*http.Request) (string, error)
                WritePath(string, http.ResponseWriter) error
                WriteList([]string, http.ResponseWriter) error
                ReadMount(*http.Request) (*Volume, error)
                WriteMount(string, http.ResponseWriter) error
           }
package: apiserver
    files: 
           /apiserver/daemon.go
    structs: 
           type DaemonConfig struct {
                Config   *config.Client
                MountTTL int
                Timeout  time.Duration
                Global   *config.Global
           }
           type volume struct {
                Name       string
                Mountpoint string
           }
package: backend
    files: 
           /storage/backend/backends.go
           /volmigrate/backend/backend.go
    interfaces: 
           type Backend interface {
                CurrentSchemaVersion() int64
                CreateDirectory(path string) error
                CreateKey(path string, contents []byte) error
                DeleteDirectory(path string) error
                DeleteKey(path string) error
                Name() string
                UpdateSchemaVersion(version int64) error
           }
package: ceph
    files: 
           /storage/backend/ceph/internals.go
           /storage/backend/ceph/util.go
           /storage/backend/ceph/ceph.go
    structs: 
           type Driver struct {
                mountpath string
           }
package: cgroup
    files: 
           /storage/cgroup/cgroup.go
package: config
    files: 
           /config/archive.go
           /config/config.go
           /config/global.go
           /config/use.go
           /config/validation.go
           /config/volume.go
           /config/policy.go
           /config/schema.go
    structs: 
           type VolumeRequest struct {
                Name    string            `json:"name"`
                Policy  string            `json:"policy"`
                Options map[string]string `json:"options"`
           }
           type Client struct {
                etcdClient client.KeysAPI
                prefix     string
           }
           type Global struct {
                Debug     bool
                Timeout   time.Duration
                TTL       time.Duration
                MountPath string
           }
           type UseVolsupervisor struct {
                Hostname string
           }
           type UseMount struct {
                Volume   string
                Hostname string
                Reason   string
           }
           type UseSnapshot struct {
                Volume string
                Reason string
           }
           type Volume struct {
                PolicyName     string            `json:"policy"`
                VolumeName     string            `json:"name"`
                Unlocked       bool              `json:"unlocked,omitempty" merge:"unlocked"`
                DriverOptions  map[string]string `json:"driver"`
                MountSource    string            `json:"mount" merge:"mount"`
                CreateOptions  CreateOptions     `json:"create"`
                RuntimeOptions RuntimeOptions    `json:"runtime"`
                Backends       *BackendDrivers   `json:"backends,omitempty"`
           }
           type CreateOptions struct {
                Size       string `json:"size" merge:"size"`
                FileSystem string `json:"filesystem" merge:"filesystem"`
           }
           type RuntimeOptions struct {
                UseSnapshots bool            `json:"snapshots" merge:"snapshots"`
                Snapshot     SnapshotConfig  `json:"snapshot"`
                RateLimit    RateLimitConfig `json:"rate-limit,omitempty"`
           }
           type RateLimitConfig struct {
                WriteBPS uint64 `json:"write-bps" merge:"rate-limit.write.bps"`
                ReadBPS  uint64 `json:"read-bps" merge:"rate-limit.read.bps"`
           }
           type SnapshotConfig struct {
                Frequency string `json:"frequency" merge:"snapshots.frequency"`
                Keep      uint   `json:"keep" merge:"snapshots.keep"`
           }
           type Policy struct {
                Name           string            `json:"name"`
                Unlocked       bool              `json:"unlocked,omitempty" merge:"unlocked"`
                CreateOptions  CreateOptions     `json:"create"`
                RuntimeOptions RuntimeOptions    `json:"runtime"`
                DriverOptions  map[string]string `json:"driver"`
                FileSystems    map[string]string `json:"filesystems"`
                Backends       *BackendDrivers   `json:"backends,omitempty"`
                Backend        string            `json:"backend,omitempty"`
           }
           type BackendDrivers struct {
                CRUD     string `json:"crud"`
                Mount    string `json:"mount"`
                Snapshot string `json:"snapshot"`
           }
    interfaces: 
           type UseLocker interface {
                GetVolume() string
                GetReason() string
                Type() string
                MayExist() bool
           }
package: control
    files: 
           /storage/control/volume.go
package: db
    files: 
           /db/constants.go
           /db/create.go
           /db/db.go
           /db/global.go
           /db/policy.go
           /db/runtime.go
           /db/schema.go
           /db/structs.go
           /db/validate_json.go
           /db/volume.go
    structs: 
           type Hooks struct {
                PreSet       Hook
                PostSet      Hook
                PreGet       Hook
                PostGet      Hook
                PreDelete    Hook
                PostDelete   Hook
                PreValidate  Hook
                PostValidate Hook
           }
           type Policy struct {
                Name           string            `json:"name"`
                Unlocked       bool              `json:"unlocked,omitempty" merge:"unlocked"`
                CreateOptions  CreateOptions     `json:"create"`
                RuntimeOptions *RuntimeOptions   `json:"runtime"`
                DriverOptions  map[string]string `json:"driver"`
                FileSystems    map[string]string `json:"filesystems"`
                Backends       *BackendDrivers   `json:"backends,omitempty"`
                Backend        string            `json:"backend,omitempty"`
           }
           type BackendDrivers struct {
                CRUD     string `json:"crud"`
                Mount    string `json:"mount"`
                Snapshot string `json:"snapshot"`
           }
           type VolumeRequest struct {
                Name    string
                Policy  *Policy
                Options map[string]string
           }
           type Global struct {
                Debug     bool
                Timeout   time.Duration
                TTL       time.Duration
                MountPath string
           }
           type UseMount struct {
                Volume   string
                Hostname string
                Reason   string
           }
           type UseSnapshot struct {
                Volume string
                Reason string
           }
           type Volume struct {
                PolicyName     string            `json:"policy"`
                VolumeName     string            `json:"name"`
                Unlocked       bool              `json:"unlocked,omitempty" merge:"unlocked"`
                DriverOptions  map[string]string `json:"driver"`
                MountSource    string            `json:"mount" merge:"mount"`
                CreateOptions  CreateOptions     `json:"create"`
                RuntimeOptions *RuntimeOptions   `json:"runtime"`
                Backends       *BackendDrivers   `json:"backends,omitempty"`
           }
           type CreateOptions struct {
                Size       string `json:"size" merge:"size"`
                FileSystem string `json:"filesystem" merge:"filesystem"`
           }
           type RuntimeOptions struct {
                UseSnapshots bool            `json:"snapshots" merge:"snapshots"`
                Snapshot     SnapshotConfig  `json:"snapshot"`
                RateLimit    RateLimitConfig `json:"rate-limit,omitempty"`
                policyName string
                volumeName string
           }
           type RateLimitConfig struct {
                WriteBPS uint64 `json:"write-bps" merge:"rate-limit.write.bps"`
                ReadBPS  uint64 `json:"read-bps" merge:"rate-limit.read.bps"`
           }
           type SnapshotConfig struct {
                Frequency string `json:"frequency" merge:"snapshots.frequency"`
                Keep      uint   `json:"keep" merge:"snapshots.keep"`
           }
    interfaces: 
           type Client interface {
                Get(Entity) error
                Set(Entity) error
                Delete(Entity) error
                Watch(Entity) (chan Entity, chan error) 
                WatchStop(Entity) error
                WatchPrefix(Entity) (chan Entity, chan error) 
                WatchPrefixStop(Entity) error
                Dump(string) (string, error)
                Prefix() string
                List(Entity) ([]Entity, error)
                ListPrefix(string, Entity) ([]Entity, error)
           }
           type Entity interface {
                SetKey(string) error
                Prefix() string
                Path() (string, error)
                Validate() error
                Copy() Entity
                Hooks() *Hooks
                fmt.Stringer
           }
           type UseLocker interface {
                GetVolume() string
                GetReason() string
                Type() string
                MayExist() bool
           }
package: docker
    files: 
           /api/impl/docker/docker.go
           /api/impl/docker/handlers.go
           /api/impl/docker/structs.go
    structs: 
           type VolumeCreateRequest struct {
                Name string
                Opts map[string]string
           }
           type Response struct {
                Mountpoint string
                Err        string
           }
           type Volume struct {
                Name       string
                Mountpoint string
           }
           type VolumeGetRequest struct {
                Name string
           }
           type VolumeGetResponse struct {
                Volume Volume
                Err    string
           }
           type VolumeList struct {
                Volumes []Volume
                Err     string
           }
package: errors
    files: 
           /errors/errors.go
           /errors/utils.go
package: etcd
    files: 
           /db/impl/etcd/client.go
           /db/impl/etcd/dump.go
    structs: 
           type Client struct {
                prefix       string
                client       client.KeysAPI
                watchers     map[string]chan struct{}
                watcherMutex sync.Mutex
           }
package: etcd2
    files: 
           /volmigrate/backend/etcd2/etcd2.go
    structs: 
           type Engine struct {
                etcdClient client.KeysAPI
                prefix     string
           }
package: info
    files: 
           /info/debug.go
package: jsonio
    files: 
           /db/jsonio/jsonreader.go
package: lock
    files: 
           /lock/lock.go
    structs: 
           type Driver struct {
                Config *config.Client
           }
package: main
    files: 
           /apiserver/apiserver/cli.go
           /volcli/volcli/cli.go
           /volmigrate/volmigrate/cli.go
           /volplugin/volplugin/cli.go
           /volsupervisor/volsupervisor/main.go
package: merge
    files: 
           /merge/casts.go
           /merge/merge.go
package: mount
    files: 
           /api/internals/mount/count.go
           /api/internals/mount/mount.go
    structs: 
           type Counter struct {
                mutex sync.Mutex
                count map[string]int
           }
           type Collection struct {
                mountMap      map[string]*storage.Mount
                mountMapMutex sync.Mutex
           }
package: mountscan
    files: 
           /storage/mountscan/mountscan.go
    structs: 
           type GetMountsRequest struct {
                DriverName   string 
                FsType       string 
                KernelDriver string 
           }
           type MountInfo struct {
                MountID        uint          
                ParentID       uint          
                DeviceNumber   *DeviceNumber 
                Root           string        
                MountPoint     string        
                MountOptions   string        
                OptionalFields string        
                Separator      string        
                FilesystemType string        
                MountSource    string
                SuperOptions   string 
           }
           type DeviceNumber struct {
                Major uint
                Minor uint
           }
package: nfs
    files: 
           /storage/backend/nfs/mount.go
           /storage/backend/nfs/nfs.go
    structs: 
           type Driver struct {
                mountpath string
           }
package: null
    files: 
           /storage/backend/null/null.go
    structs: 
           type Driver struct {
                mountpath string
           }
package: storage
    files: 
           /storage/driver.go
           /storage/utils.go
    structs: 
           type Mount struct {
                Device   string
                Path     string
                DevMajor uint
                DevMinor uint
                Volume   Volume
           }
           type FSOptions struct {
                Type          string
                CreateCommand string
           }
           type DriverOptions struct {
                Source    string
                Volume    Volume
                FSOptions FSOptions
                Timeout   time.Duration
                Options   map[string]string
           }
           type ListOptions struct {
                Params Params
           }
           type Volume struct {
                Name   string
                Size   uint64
                Params Params
           }
    interfaces: 
           type NamedDriver interface {
                Name() string
           }
           type ValidatingDriver interface {
                Validate(*DriverOptions) error
           }
           type MountDriver interface {
                NamedDriver
                ValidatingDriver
                Mount(DriverOptions) (*Mount, error)
                Unmount(DriverOptions) error
                Mounted(time.Duration) ([]*Mount, error)
                MountPath(DriverOptions) (string, error)
           }
           type CRUDDriver interface {
                NamedDriver
                ValidatingDriver
                Create(DriverOptions) error
                Format(DriverOptions) error
                Destroy(DriverOptions) error
                List(ListOptions) ([]Volume, error)
                Exists(DriverOptions) (bool, error)
           }
           type SnapshotDriver interface {
                NamedDriver
                ValidatingDriver
                CreateSnapshot(string, DriverOptions) error
                RemoveSnapshot(string, DriverOptions) error
                ListSnapshots(DriverOptions) ([]string, error)
                CopySnapshot(DriverOptions, string, string) error
           }
package: test
    files: 
           /storage/backend/test/test.go
    structs: 
           type Driver struct {
                BaseMountPath string
                CreatedMap    map[string]bool
                MountedMap    map[string]bool
                client client.KeysAPI
           }
package: volcli
    files: 
           /volcli/commands.go
           /volcli/volcli.go
package: volmigrate
    files: 
           /volmigrate/commands.go
           /volmigrate/migration.go
           /volmigrate/schema_migrations.go
           /volmigrate/volmigrate.go
    structs: 
           type Migration struct {
                Version     int64  
                Description string 
                runner      func(backend.Backend) error
           }
package: volplugin
    files: 
           /volplugin/init.go
           /volplugin/runtime.go
           /volplugin/volplugin.go
    structs: 
           type DaemonConfig struct {
                Hostname   string
                Global     *config.Global
                Client     *config.Client
                API        *api.API
                PluginName string
           }
package: volsupervisor
    files: 
           /volsupervisor/loop.go
           /volsupervisor/volsupervisor.go
           /volsupervisor/watches.go
    structs: 
           type DaemonConfig struct {
                Global   *config.Global
                Config   *config.Client
                Hostname string
           }
package: watch
    files: 
           /watch/watch.go
    structs: 
           type Watch struct {
                Key    string
                Config interface{}
           }
           type Watcher struct {
                WatcherFunc
                Path         string
                Channel      chan *Watch
                StopChannel  chan struct{}
                ErrorChannel chan error
                StopOnError  bool
                Recursive    bool
           }

分类
2篇
c
1篇
8篇
18篇
8篇
2篇
搜索