mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
29 lines
534 B
Go
29 lines
534 B
Go
package containerd
|
|
|
|
import (
|
|
"context"
|
|
|
|
containerd "github.com/containerd/containerd/v2/client"
|
|
)
|
|
|
|
const (
|
|
DefaultSocketPath = "/run/containerd/containerd.sock"
|
|
DefaultNamespace = "default"
|
|
)
|
|
|
|
type ClientFactory interface {
|
|
New(ctx context.Context) (*containerd.Client, error)
|
|
}
|
|
|
|
type DefaultClientFactory struct {
|
|
SocketPath string
|
|
}
|
|
|
|
func (f DefaultClientFactory) New(_ context.Context) (*containerd.Client, error) {
|
|
socket := f.SocketPath
|
|
if socket == "" {
|
|
socket = DefaultSocketPath
|
|
}
|
|
return containerd.New(socket)
|
|
}
|