snapshot

package
v0.0.0-...-b9a05f1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSnapshotSupported

func IsSnapshotSupported(info SnapshotInputInfo) (bool, error)

func ListSnapshotByProto

func ListSnapshotByProto(proto string) (snapshots []string)

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

type SnapshotOutputInfo struct {
	Data  []byte
	Error error
}

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 (*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 (*UpdateServiceSnapshotByContainer) Process

func (*UpdateServiceSnapshotByContainer) Supported

func (m *UpdateServiceSnapshotByContainer) Supported(proto string) bool

Jump to

Keyboard shortcuts

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