Documentation ¶
Index ¶
- Constants
- Variables
- func Check(logger LogFn, cs ...CheckFn) error
- func CheckDirectUpload(verbose bool, logger LogFn) error
- func CheckDirectUploadIPPort(ip, port string, logger LogFn) error
- func GetMetafilePaths(dir string) ([]string, error)
- func QuietLog(string, ...interface{})
- func SuggestBucket(method, bucket, kind string) (string, error)
- func SuggestCurrency(currency string) (string, error)
- func SuggestUploadMethod(method, kind string) (string, bool)
- type CheckFn
- func CheckAPIServer() CheckFn
- func CheckAPIServerLite() CheckFn
- func CheckBalance(min float64) CheckFn
- func CheckDir(d string) CheckFn
- func CheckDirOrZip(p string) CheckFn
- func CheckFile(f string) CheckFn
- func CheckFilename(f string, r *regexp.Regexp) CheckFn
- func CheckFilenames(filePath string, allowed []string) CheckFn
- func CheckIsLogin() CheckFn
- func CheckNonNegative(i float64) CheckFn
- func CheckPID(kind, pid string) CheckFn
- func CheckUploadMethod(kind, method, ip, port string, skip bool) CheckFn
- func CheckZip(f string) CheckFn
- type LogFn
Constants ¶
const DirectUploadMethod = "direct"
DirectUploadMethod is the literal used in the arags of the import command.
const Failed = "Failed"
Failed represents the image or model or meta failed state.
const MinioUploadMethod = "minio"
MinioUploadMethod is the literal used in the arags of the import command.
const NormalMode = "Normal"
NormalMode is the literal of normal mode returned from gql.
const OSSUploadMethod = "oss"
OSSUploadMethod is the literal used in the arags of the import command.
const Pending = "Pending"
Pending represents the image or model or meta pending state.
const ReadOnlyMode = "ReadOnly"
ReadOnlyMode is the literal of read-only mode returned from gql.
const Ready = "Ready"
Ready represents the image or model or meta ready state.
const S3UploadMethod = "s3"
S3UploadMethod is the literal used in the arags of the import command.
const Yes = "YES"
Yes represents an answer of yes.
Variables ¶
var ValidMetafileNames = []string{"camera.txt", "pose.txt", "group.txt", "initial.xms", "initial.xms.zip"}
ValidMetafileNames specifies the valid metafile names.
Functions ¶
func CheckDirectUpload ¶
CheckDirectUpload checks if direct upload is supported.
func CheckDirectUploadIPPort ¶
CheckDirectUploadIPPort checks if the given ip and port could be accessed by api server.
func GetMetafilePaths ¶
GetMetafilePaths gets all valid metafile paths in the root level of a directory.
func SuggestBucket ¶
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 ¶
SuggestCurrency suggests the best match currency.
func SuggestUploadMethod ¶
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 ¶
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 ¶
CheckBalance checks if the current user has at least min number of coins.
func CheckDirOrZip ¶
CheckDirOrZip checks if the input is a directory or a zip file.
func CheckFilename ¶
CheckFilename checks if the filename matches with the regex.
func CheckFilenames ¶
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 ¶
CheckNonNegative checks if the number is non negative.
func CheckPID ¶
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 ¶
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.