Documentation ¶
Overview ¶
Copyright 2014 Huawei Technologies Co., Ltd. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 Huawei Technologies Co., Ltd. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func IsSnapshotSupported(info SnapshotInputInfo) (bool, error)
- func ListSnapshotByProto(proto string) (snapshots []string)
- func RegisterSnapshot(name string, f UpdateServiceSnapshot) error
- func UnregisterAllSnapshot()
- type Callback
- type SnapshotInputInfo
- type SnapshotOutputInfo
- type UpdateServiceSnapshot
- type UpdateServiceSnapshotAppv1
- type UpdateServiceSnapshotByContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSnapshotSupported ¶
func IsSnapshotSupported(info SnapshotInputInfo) (bool, error)
func ListSnapshotByProto ¶
func RegisterSnapshot ¶
func RegisterSnapshot(name string, f UpdateServiceSnapshot) error
RegisterSnapshot provides a way to dynamically register an implementation of a snapshot type.
func UnregisterAllSnapshot ¶
func UnregisterAllSnapshot()
Types ¶
type Callback ¶
type Callback func(id string, output SnapshotOutputInfo) error
Callback is a function that a snapshot plugin use after finish the `Process` configuration.
type SnapshotInputInfo ¶
type SnapshotInputInfo struct { // Snapshot Plugin name. // There are two types of Snapshot: // one is simple snapshot, just like 'appv1',calling 'Process' directly. // one is group snapshot, just like 'bycontainer/scanimage', using `scanimage` to 'Process'. Name string // Dockyard server host address, Host string // CallbackID, encrytped // TODO with timestamp? CallbackID string // CallbackFunc: if callback is nil, the caller could handle it by itself // or the caller must implement calling this in `Process` CallbackFunc Callback DataProto string // dir/file url of the data DataURL string }
func (*SnapshotInputInfo) GetName ¶
func (info *SnapshotInputInfo) GetName() (string, string)
type SnapshotOutputInfo ¶
TODO: Better structed
type UpdateServiceSnapshot ¶
type UpdateServiceSnapshot interface { New(info SnapshotInputInfo) (UpdateServiceSnapshot, error) // `proto`: `appv1/dockerv1` for example Supported(proto string) bool Description() string Process() error }
UpdateServiceSnapshot represents the snapshot interface
func NewUpdateServiceSnapshot ¶
func NewUpdateServiceSnapshot(info SnapshotInputInfo) (UpdateServiceSnapshot, error)
NewUpdateServiceSnapshot creates a snapshot interface by an info and a url
type UpdateServiceSnapshotAppv1 ¶
type UpdateServiceSnapshotAppv1 struct {
// contains filtered or unexported fields
}
func (*UpdateServiceSnapshotAppv1) Description ¶
func (m *UpdateServiceSnapshotAppv1) Description() string
func (*UpdateServiceSnapshotAppv1) New ¶
func (m *UpdateServiceSnapshotAppv1) New(info SnapshotInputInfo) (UpdateServiceSnapshot, error)
func (*UpdateServiceSnapshotAppv1) Process ¶
func (m *UpdateServiceSnapshotAppv1) Process() error
func (*UpdateServiceSnapshotAppv1) Supported ¶
func (m *UpdateServiceSnapshotAppv1) Supported(proto string) bool
type UpdateServiceSnapshotByContainer ¶
type UpdateServiceSnapshotByContainer struct {
// contains filtered or unexported fields
}
func (*UpdateServiceSnapshotByContainer) Description ¶
func (m *UpdateServiceSnapshotByContainer) Description() string
func (*UpdateServiceSnapshotByContainer) New ¶
func (m *UpdateServiceSnapshotByContainer) New(info SnapshotInputInfo) (UpdateServiceSnapshot, error)
func (*UpdateServiceSnapshotByContainer) Process ¶
func (m *UpdateServiceSnapshotByContainer) Process() error
func (*UpdateServiceSnapshotByContainer) Supported ¶
func (m *UpdateServiceSnapshotByContainer) Supported(proto string) bool