snapshotserver

package
v0.0.0-...-2d5dc59 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2017 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Copyright 2016 The Transicator Authors

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.

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.

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.

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.

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.

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

View Source
var ErrUsage = errors.New("Invalid arguments")

ErrUsage is returned when the user passes incorrect command-line arguments.

Functions

func Close

func Close()

Close closes the database and does other necessary cleanup.

func DownloadSnapshot

func DownloadSnapshot(
	w http.ResponseWriter, r *http.Request,
	db *sql.DB, p httprouter.Params)

DownloadSnapshot downloads and returns the JSON related to the scope

func GenSnapshot

func GenSnapshot(w http.ResponseWriter, r *http.Request)

GenSnapshot is currently implemented in SYNC mode, where in, it simply returns the scope back the ID redirect URL to query upon, to get the snapshot - which is yet another SYNC operation

func GetScopeData

func GetScopeData(cid string, db *sql.DB) (b []byte, err error)

GetScopeData actually pulls the data for a scope.

func GetScopes

func GetScopes(
	w http.ResponseWriter, r *http.Request,
	db *sql.DB, p httprouter.Params)

GetScopes returns the set of scopes for a particular cluster.

func GetTenantSnapshotData

func GetTenantSnapshotData(
	tenantID []string, mediaType string,
	db *sql.DB, w io.Writer) error

GetTenantSnapshotData pulls the snapshot for a given set of tenants and sends them back to a response writer.

func GetTenants

func GetTenants(tenantID []string) string

GetTenants returns a list of tenant IDs turned into a string.

func Run

func Run() (*goscaffold.HTTPScaffold, error)

Run starts the snapshot server. It will listen on an HTTP port as directed by the Viper configuration. This method will block until either there is an error, or the server is stopped, so a goroutine is recommended if running this as part of a unit test.

func SetConfigDefaults

func SetConfigDefaults()

SetConfigDefaults sets up Viper for command-line and other processing.

func WriteSqliteSnapshot

func WriteSqliteSnapshot(scopes []string, db *sql.DB, w http.ResponseWriter, r *http.Request) error

WriteSqliteSnapshot is responsible for generating the SQLite format of the snapshot, and also for streaming the file back to the caller.

Types

This section is empty.

Jump to

Keyboard shortcuts

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