driverutil

package
v2.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// EnvVarAWSExecutionEnv is the AWS Execution environment variable.
	EnvVarAWSExecutionEnv = "AWS_EXECUTION_ENV"
	// EnvVarAWSLambdaRuntimeAPI is the AWS Lambda runtime API variable.
	EnvVarAWSLambdaRuntimeAPI = "AWS_LAMBDA_RUNTIME_API"
	// EnvVarFunctionsWorkerRuntime is the functions worker runtime variable.
	EnvVarFunctionsWorkerRuntime = "FUNCTIONS_WORKER_RUNTIME"
	// EnvVarKService is the K Service variable.
	EnvVarKService = "K_SERVICE"
	// EnvVarFunctionName is the function name variable.
	EnvVarFunctionName = "FUNCTION_NAME"
	// EnvVarVercel is the Vercel variable.
	EnvVarVercel = "VERCEL"
	// EnvVarK8s is the K8s variable.
	EnvVarK8s = "KUBERNETES_SERVICE_HOST"
)
View Source
const (

	// EnvVarAWSRegion is the AWS region variable.
	EnvVarAWSRegion = "AWS_REGION"
	// EnvVarAWSLambdaFunctionMemorySize is the AWS Lambda function memory size variable.
	EnvVarAWSLambdaFunctionMemorySize = "AWS_LAMBDA_FUNCTION_MEMORY_SIZE"
	// EnvVarFunctionMemoryMB is the function memory in megabytes variable.
	EnvVarFunctionMemoryMB = "FUNCTION_MEMORY_MB"
	// EnvVarFunctionTimeoutSec is the function timeout in seconds variable.
	EnvVarFunctionTimeoutSec = "FUNCTION_TIMEOUT_SEC"
	// EnvVarFunctionRegion is the function region variable.
	EnvVarFunctionRegion = "FUNCTION_REGION"
	// EnvVarVercelRegion is the Vercel region variable.
	EnvVarVercelRegion = "VERCEL_REGION"
)
View Source
const (

	// EnvNameAWSLambda is the AWS Lambda environment name.
	EnvNameAWSLambda = "aws.lambda"
	// EnvNameAzureFunc is the Azure Function environment name.
	EnvNameAzureFunc = "azure.func"
	// EnvNameGCPFunc is the Google Cloud Function environment name.
	EnvNameGCPFunc = "gcp.func"
	// EnvNameVercel is the Vercel environment name.
	EnvNameVercel = "vercel"
)
View Source
const (
	AbortTransactionOp  = "abortTransaction"  // AbortTransactionOp is the name for aborting a transaction
	AggregateOp         = "aggregate"         // AggregateOp is the name for aggregating
	CommitTransactionOp = "commitTransaction" // CommitTransactionOp is the name for committing a transaction
	CountOp             = "count"             // CountOp is the name for counting
	CreateOp            = "create"            // CreateOp is the name for creating
	CreateIndexesOp     = "createIndexes"     // CreateIndexesOp is the name for creating indexes
	DeleteOp            = "delete"            // DeleteOp is the name for deleting
	DistinctOp          = "distinct"          // DistinctOp is the name for distinct
	DropOp              = "drop"              // DropOp is the name for dropping
	DropDatabaseOp      = "dropDatabase"      // DropDatabaseOp is the name for dropping a database
	DropIndexesOp       = "dropIndexes"       // DropIndexesOp is the name for dropping indexes
	EndSessionsOp       = "endSessions"       // EndSessionsOp is the name for ending sessions
	FindAndModifyOp     = "findAndModify"     // FindAndModifyOp is the name for finding and modifying
	FindOp              = "find"              // FindOp is the name for finding
	InsertOp            = "insert"            // InsertOp is the name for inserting
	ListCollectionsOp   = "listCollections"   // ListCollectionsOp is the name for listing collections
	ListIndexesOp       = "listIndexes"       // ListIndexesOp is the name for listing indexes
	ListDatabasesOp     = "listDatabases"     // ListDatabasesOp is the name for listing databases
	UpdateOp            = "update"            // UpdateOp is the name for updating
)

Operation Names should be sourced from the command reference documentation: https://www.mongodb.com/docs/manual/reference/command/

View Source
const AwsLambdaPrefix = "AWS_Lambda_"

Variables

This section is empty.

Functions

func CompareTopologyVersions

func CompareTopologyVersions(receiver, response *description.TopologyVersion) int

CompareTopologyVersions compares the receiver, which represents the currently known TopologyVersion for a server, to an incoming TopologyVersion extracted from a server command response.

This returns -1 if the receiver version is less than the response, 0 if the versions are equal, and 1 if the receiver version is greater than the response. This comparison is not commutative.

func EqualServers

func EqualServers(srv1, srv2 description.Server) bool

EqualServers compares two server descriptions and returns true if they are equal.

func GetFaasEnvName

func GetFaasEnvName() string

GetFaasEnvName parses the FaaS environment variable name and returns the corresponding name used by the client. If none of the variables or variables for multiple names are populated the client.env value MUST be entirely omitted. When variables for multiple "client.env.name" values are present, "vercel" takes precedence over "aws.lambda"; any other combination MUST cause "client.env" to be entirely omitted.

func IsServerLoadBalanced

func IsServerLoadBalanced(srv description.Server) bool

IsServerLoadBalanced checks if a description.Server describes a server that is load balanced.

func NewServerDescription

func NewServerDescription(addr address.Address, response bson.Raw) description.Server

NewServerDescription creates a new server description from the given hello command response.

func NewTopologyVersion

func NewTopologyVersion(doc bson.Raw) (*description.TopologyVersion, error)

NewTopologyVersion creates a TopologyVersion based on doc

func NewVersionRange

func NewVersionRange(min, max int32) description.VersionRange

NewVersionRange creates a new VersionRange given a min and a max.

func VersionRangeIncludes

func VersionRangeIncludes(versionRange description.VersionRange, v int32) bool

VersionRangeIncludes returns a bool indicating whether the supplied integer is included in the range.

Types

This section is empty.

Jump to

Keyboard shortcuts

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