Documentation
¶
Index ¶
- Constants
- Variables
- func Destroy(id ContainerID) error
- func Execute(contID ContainerID, req *executor.InvocationRequest) (*executor.InvocationResult, time.Duration, error)
- func GetMemoryMB(id ContainerID) (int64, error)
- type ContainerID
- type ContainerOptions
- type DockerFactory
- func (cf *DockerFactory) CopyToContainer(contID ContainerID, content io.Reader, destPath string) error
- func (cf *DockerFactory) Create(image string, opts *ContainerOptions) (ContainerID, error)
- func (cf *DockerFactory) Destroy(contID ContainerID) error
- func (cf *DockerFactory) GetIPAddress(contID ContainerID) (string, error)
- func (cf *DockerFactory) GetMemoryMB(contID ContainerID) (int64, error)
- func (cf *DockerFactory) HasImage(image string) bool
- func (cf *DockerFactory) Start(contID ContainerID) error
- type Factory
- type RuntimeInfo
Constants ¶
View Source
const CUSTOM_RUNTIME = "custom"
Variables ¶
View Source
var RuntimeToInfo = map[string]RuntimeInfo{ "python310": RuntimeInfo{"grussorusso/serverledge-python310", []string{"python", "/entrypoint.py"}}, "nodejs17": RuntimeInfo{"grussorusso/serverledge-nodejs17", []string{"node", "/entrypoint.js"}}, "nodejs17ng": RuntimeInfo{"grussorusso/serverledge-nodejs17ng", []string{}}, }
Functions ¶
func Destroy ¶
func Destroy(id ContainerID) error
func Execute ¶
func Execute(contID ContainerID, req *executor.InvocationRequest) (*executor.InvocationResult, time.Duration, error)
Execute interacts with the Executor running in the container to invoke the function through a HTTP request.
func GetMemoryMB ¶
func GetMemoryMB(id ContainerID) (int64, error)
Types ¶
type ContainerID ¶
type ContainerID = string
func NewContainer ¶
func NewContainer(image, codeTar string, opts *ContainerOptions) (ContainerID, error)
NewContainer creates and starts a new container.
type ContainerOptions ¶
ContainerOptions contains options for container creation.
type DockerFactory ¶
type DockerFactory struct {
// contains filtered or unexported fields
}
func InitDockerContainerFactory ¶
func InitDockerContainerFactory() *DockerFactory
func (*DockerFactory) CopyToContainer ¶
func (cf *DockerFactory) CopyToContainer(contID ContainerID, content io.Reader, destPath string) error
func (*DockerFactory) Create ¶
func (cf *DockerFactory) Create(image string, opts *ContainerOptions) (ContainerID, error)
func (*DockerFactory) Destroy ¶
func (cf *DockerFactory) Destroy(contID ContainerID) error
func (*DockerFactory) GetIPAddress ¶
func (cf *DockerFactory) GetIPAddress(contID ContainerID) (string, error)
func (*DockerFactory) GetMemoryMB ¶
func (cf *DockerFactory) GetMemoryMB(contID ContainerID) (int64, error)
func (*DockerFactory) HasImage ¶
func (cf *DockerFactory) HasImage(image string) bool
func (*DockerFactory) Start ¶
func (cf *DockerFactory) Start(contID ContainerID) error
type Factory ¶
type Factory interface {
Create(string, *ContainerOptions) (ContainerID, error)
CopyToContainer(ContainerID, io.Reader, string) error
Start(ContainerID) error
Destroy(ContainerID) error
HasImage(string) bool
GetIPAddress(ContainerID) (string, error)
GetMemoryMB(id ContainerID) (int64, error)
}
A Factory to create and manage container.
type RuntimeInfo ¶
RuntimeInfo contains information about a supported function runtime env.
Click to show internal directories.
Click to hide internal directories.