service

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DirectUploadMethod = "direct"

DirectUploadMethod is the literal used in the arags of the import command.

View Source
const Failed = "Failed"

Failed represents the image or model or meta failed state.

View Source
const MinioUploadMethod = "minio"

MinioUploadMethod is the literal used in the arags of the import command.

View Source
const NormalMode = "Normal"

NormalMode is the literal of normal mode returned from gql.

View Source
const OSSUploadMethod = "oss"

OSSUploadMethod is the literal used in the arags of the import command.

View Source
const Pending = "Pending"

Pending represents the image or model or meta pending state.

View Source
const ReadOnlyMode = "ReadOnly"

ReadOnlyMode is the literal of read-only mode returned from gql.

View Source
const Ready = "Ready"

Ready represents the image or model or meta ready state.

View Source
const S3UploadMethod = "s3"

S3UploadMethod is the literal used in the arags of the import command.

View Source
const Yes = "YES"

Yes represents an answer of yes.

Variables

View Source
var ValidMetafileNames = []string{"camera.txt", "pose.txt", "group.txt", "initial.xms", "initial.xms.zip"}

ValidMetafileNames specifies the valid metafile names.

Functions

func Check

func Check(logger LogFn, cs ...CheckFn) error

Check checks all of the passed in checker functions.

func CheckDirectUpload

func CheckDirectUpload(verbose bool, logger LogFn) error

CheckDirectUpload checks if direct upload is supported.

func CheckDirectUploadIPPort

func CheckDirectUploadIPPort(ip, port string, logger LogFn) error

CheckDirectUploadIPPort checks if the given ip and port could be accessed by api server.

func GetMetafilePaths

func GetMetafilePaths(dir string) ([]string, error)

GetMetafilePaths gets all valid metafile paths in the root level of a directory.

func QuietLog

func QuietLog(string, ...interface{})

QuietLog is a dummy func for logging nothing.

func SuggestBucket

func SuggestBucket(method, bucket, kind string) (string, error)

SuggestBucket suggests the best bucket if it is not set. And check if the bucket is valid if is set. Prefer the geo closest and supported one. kind is "image", "model" or "meta".

func SuggestCurrency

func SuggestCurrency(currency string) (string, error)

SuggestCurrency suggests the best match currency.

func SuggestUploadMethod

func SuggestUploadMethod(method, kind string) (string, bool)

SuggestUploadMethod suggests the best upload method if it is not set. Prefer direct upload over s3 over oss. kind is "image" or "model" or "meta". Return suggested method: "direct", "s3", "oss", "" and if it is suggested or not. If this is false, further checking is needed.

Types

type CheckFn

type CheckFn func(LogFn) error

CheckFn represents a checker function.

func CheckAPIServer

func CheckAPIServer() CheckFn

CheckAPIServer checks if API server is in normal mode.

func CheckAPIServerLite added in v1.1.1

func CheckAPIServerLite() CheckFn

CheckAPIServerLite checks if API server is online, possibly in ReadOnly mode.

func CheckBalance

func CheckBalance(min float64) CheckFn

CheckBalance checks if the current user has at least min number of coins.

func CheckDir

func CheckDir(d string) CheckFn

CheckDir checks if the file is a directory.

func CheckDirOrZip

func CheckDirOrZip(p string) CheckFn

CheckDirOrZip checks if the input is a directory or a zip file.

func CheckFile

func CheckFile(f string) CheckFn

CheckFile checks if the file exists.

func CheckFilename

func CheckFilename(f string, r *regexp.Regexp) CheckFn

CheckFilename checks if the filename matches with the regex.

func CheckFilenames

func CheckFilenames(filePath string, allowed []string) CheckFn

CheckFilenames checks if filenames are valid.

func CheckIsLogin added in v1.1.1

func CheckIsLogin() CheckFn

CheckIsLogin check if user has logged in.

func CheckNonNegative

func CheckNonNegative(i float64) CheckFn

CheckNonNegative checks if the number is non negative.

func CheckPID

func CheckPID(kind, pid string) CheckFn

CheckPID checks if the pid of the right kind (if provided) exists. kind is "image", "model" or "meta". Provide an empty string of kind if want to check existence of any kind of project.

func CheckUploadMethod

func CheckUploadMethod(kind, method, ip, port string, skip bool) CheckFn

CheckUploadMethod checks if the supplied upload method is suppored. kind is 'image', 'model' or 'meta' if skip is true, this check is skipped. This flag is supposed to be given by function service.SuggestUploadMethod.

func CheckZip

func CheckZip(f string) CheckFn

CheckZip checks if the file is a zip.

type LogFn

type LogFn func(string, ...interface{})

LogFn represents a logger function. Same signature as log.Printf.

Jump to

Keyboard shortcuts

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