utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2019 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// One operation returns a single document from the database
	One string = "one"

	// All operation returns multiple documents from the database
	All string = "all"

	// Count operation returns the number of documents which match the condition
	Count string = "count"

	// Distinct operation returns distinct values
	Distinct string = "distinct"

	// Upsert creates a new document if it doesn't exist, else it updates exiting document
	Upsert string = "upsert"
)
View Source
const (
	// RealtimeWorkerCount are the number of goroutines to process realtime data
	RealtimeWorkerCount int = 10

	// FunctionsWorkerCount are the number of goroutines to process functions data
	FunctionsWorkerCount int = 10

	// RealtimeInsert is for create operations
	RealtimeInsert string = "insert"

	// RealtimeUpdate is for update operations
	RealtimeUpdate string = "update"

	// RealtimeDelete is for delete operations
	RealtimeDelete string = "delete"

	// RealtimeInitial is for the initial data
	RealtimeInitial string = "initial"
)
View Source
const (
	// TypeRealtimeSubscribe is the request type for live query subscription
	TypeRealtimeSubscribe string = "realtime-subscribe"

	// TypeRealtimeUnsubscribe is the request type for live query subscription
	TypeRealtimeUnsubscribe string = "realtime-unsubscribe"

	// TypeRealtimeFeed is the response type for realtime feed
	TypeRealtimeFeed string = "realtime-feed"

	// TypeServiceRegister is the request type for service registration
	TypeServiceRegister string = "service-register"

	// TypeServiceUnregister is the request type for service removal
	TypeServiceUnregister string = "service-unregister"

	// TypeServiceRequest is type triggering a service's function
	TypeServiceRequest string = "service-request"
)
View Source
const (
	// PortHTTP is the port used for the http server
	PortHTTP string = "4122"

	// PortGRPC is the port used for the grpc server
	PortGRPC string = "4124"

	// PortHTTPSecure is the port used for the http server with tls
	PortHTTPSecure string = "4126"

	// PortGRPCSecure is the port used for the grpc server with tls
	PortGRPCSecure string = "4128"

	// PortNatsServer is the port used for nats
	PortNatsServer int = 4222

	// PortNatsCluster is the port used by nats for clustering
	PortNatsCluster int = 4248

	// PortGossip is used for the membership protocol
	PortGossip string = "4232"

	// PortRaft is used internally by raft
	PortRaft string = "4234"
)
View Source
const BuildVersion = "0.10.0"

BuildVersion is the current version of Space Cloud

View Source
const DefaultConfigFilePath string = "config.yaml"

DefaultConfigFilePath is the default path to load / store the config file

View Source
const (
	// PayloadSize is the size of the payload(in bytes) in file upload and download
	PayloadSize int = 256 * 1024 // 256 kB
)
View Source
const RaftSnapshotDirectory string = "raft-store"

RaftSnapshotDirectory is where the snapshot of the log is stored

View Source
const (
	// ScopeDeploy is te scope used for the deploy module
	ScopeDeploy string = "deploy"
)
View Source
const TypeRegisterRequest string = "register"

TypeRegisterRequest is the space cloud register request

Variables

View Source
var ErrInvalidParams = errors.New("CRUD: Invalid parameter provided")

ErrInvalidParams is thrown when the input parameters for an operation are invalid

Functions

func Adjust

func Adjust(obj interface{}, state map[string]interface{}) interface{}

Adjust loads value from state if referenced

func DownloadFileFromURL added in v0.10.0

func DownloadFileFromURL(url, dest string) error

DownloadFileFromURL downloads a file from url and stores it at a given destination

func LoadBool

func LoadBool(key interface{}, args map[string]interface{}) (bool, error)

LoadBool loads a key as a float. Throws error

func LoadNumber

func LoadNumber(key interface{}, args map[string]interface{}) (float64, error)

LoadNumber loads a key as a float. Throws error

func LoadStringIfExists

func LoadStringIfExists(value string, state map[string]interface{}) string

LoadStringIfExists loads a value if its present else returns the same

func LoadValue

func LoadValue(key string, state map[string]interface{}) (interface{}, error)

LoadValue loads a value from the state

func Unzip added in v0.10.0

func Unzip(src string, dest string) error

Unzip unzips a source file to a given destination

func UserHomeDir added in v0.10.0

func UserHomeDir() string

UserHomeDir returns the path of home directory of user

Types

type Broker

type Broker string

Broker is the type of broker used by Space Cloud

const (
	// Nats is the type used for Nats
	Nats Broker = "nats"
)

type DBType

type DBType string

DBType is the type of database used for a particular crud operation

const (
	// Mongo is the type used for MongoDB
	Mongo DBType = "mongo"

	// MySQL is the type used for MySQL
	MySQL DBType = "sql-mysql"

	// Postgres is the type used for PostgresQL
	Postgres DBType = "sql-postgres"
)

type FileOpType

type FileOpType string

FileOpType is the type of file operation being performed on the file store

const (
	// FileRead is the type used for read operations
	FileRead FileOpType = "read"

	// FileCreate is the type used for create operations
	FileCreate FileOpType = "create"

	// FileDelete is the type used for delete operations
	FileDelete FileOpType = "delete"
)

type FileStoreType

type FileStoreType string

FileStoreType is the type of file store used

const (
	// Local is the type used for the local filesystem
	Local FileStoreType = "local"

	// AmazonS3 is the type used for the AmazonS3 storage
	AmazonS3 FileStoreType = "amazon-s3"
)

type OperationType

type OperationType string

OperationType is the type of operation being performed on the database

const (
	// Create is the type used for insert operations
	Create OperationType = "create"

	// Read is the type used for query operation
	Read OperationType = "read"

	// Update is the type used ofr update operations
	Update OperationType = "update"

	// Delete is the type used for delete operations
	Delete OperationType = "delete"

	// Aggregation is the type used for aggregations
	Aggregation OperationType = "aggr"
)

type OrchestratorType added in v0.10.0

type OrchestratorType string

OrchestratorType is the type of the orchestrator

const (
	// Kubernetes is the type used for a kubernetes deployement
	Kubernetes OrchestratorType = "kubernetes"
)

type RaftCommandType added in v0.10.0

type RaftCommandType string

RaftCommandType is the type received in the raft commands

const (
	// RaftCommandSet is used to set a projects config
	RaftCommandSet RaftCommandType = "set"

	// RaftCommandDelete is used to delete a projects config
	RaftCommandDelete RaftCommandType = "delete"
)

type RealTimeProtocol

type RealTimeProtocol string

RealTimeProtocol is the type of protocol requested for realtime.

const (
	// Websocket for realtime implementation.
	Websocket RealTimeProtocol = "Websocket"

	// GRPC for realtime implementation.
	GRPC RealTimeProtocol = "GRPC"

	// GRPCService for Service implementation.
	GRPCService RealTimeProtocol = "GRPC-Service"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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