common

package module
v0.0.0-...-d850e80 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

README

Cells Runtime

cells-runtime provides the reusable service runtime extracted from Pydio Cells. It contains lifecycle orchestration, registries, brokers, configuration stores, storage drivers, HTTP and gRPC servers, telemetry, and the infrastructure protobuf contracts needed by those components.

Applications supply product policy through explicit integration hooks. The runtime does not import the Cells application module.

Development

The module uses the Go version and toolchain declared in go.mod.

GOWORK=off go build ./...
GOWORK=off go test ./...

Some filesystem notification tests require native host event access, and the NTP test requires network access. Run those checks on a host with the required facilities.

Protocol definitions live under proto/. Generated Go bindings are committed; edit schemas and generation configuration before regenerating them.

The runtime owns its custom protobuf generators under tools/. Generate one contract group with ./proto/buf.sh service (or another directory listed in proto/buf.work.yaml). Generator and protobuf dependency versions are pinned by this module; the script does not generate external SDKs.

Documentation

Index

Constants

View Source
const (
	ServiceLog      = "log"
	ServiceConfig   = "config"
	ServiceBroker   = "broker"
	ServiceRegistry = "registry"
	ServicePprof    = "pprof"
	ServiceOAuth    = "oauth"

	ServiceTagGateway = "gateway"

	CacheTypeShared     = "shared"
	CacheTypeLocal      = "local"
	QueueTypePersistent = "persistent"
	QueueTypeDebouncer  = "debouncer"

	CtxTargetServiceName  = "service"
	CtxGrpcClientCaller   = "grpc-client-caller"
	CtxGrpcSilentNotFound = "grpc-silent-not-found"
)
View Source
const (
	KeyMsgId  = "MsgId"
	KeyTs     = "Ts"
	KeyNano   = "Nano"
	KeyLevel  = "Level"
	KeyLogger = "Logger"
	KeyMsg    = "Msg"
)

Define string used as keys.

View Source
const (
	// Login
	AuditLoginSucceed      = "1"
	AuditLoginFailed       = "2"
	AuditLoginPolicyDenial = "3"
	AuditInvalidJwt        = "4"
	AuditLockUser          = "5"

	// Tree events
	AuditNodeCreate     = "11"
	AuditNodeRead       = "12"
	AuditNodeList       = "13"
	AuditNodeUpdate     = "14"
	AuditNodeUpdatePath = "20"
	AuditNodeMovedToBin = "19"
	AuditNodeDelete     = "15"

	// Ws Event
	AuditWsCreate = "16"
	AuditWsUpdate = "17"
	AuditWsDelete = "18"

	// S3 Objects
	AuditObjectGet = "21"
	AuditObjectPut = "22"

	// Users, Group, Roles
	AuditUserCreate  = "41"
	AuditUserRead    = "42"
	AuditUserUpdate  = "43"
	AuditUserDelete  = "44"
	AuditGroupCreate = "46"
	AuditGroupRead   = "47"
	AuditGroupUpdate = "48"
	AuditGroupDelete = "49"
	AuditRoleCreate  = "51"
	AuditRoleRead    = "52"
	AuditRoleUpdate  = "53"
	AuditRoleDelete  = "54"

	// Policies
	AuditPolicyGroupStore  = "61"
	AuditPolicyGroupDelete = "62"
	AuditPolicyStore       = "63"
	AuditPolicyDelete      = "64"

	// ShareLinks And Cells
	AuditCellCreate = "71"
	AuditCellRead   = "72"
	AuditCellUpdate = "73"
	AuditCellDelete = "74"
	AuditLinkCreate = "75"
	AuditLinkRead   = "76"
	AuditLinkUpdate = "77"
	AuditLinkDelete = "78"
)

Known audit message IDs

View Source
const (
	KeyContext = "Context"

	// Follow a given request between the various services
	KeySpanOtel       = "SpanOtel"
	KeySpanUuid       = "SpanUuid"
	KeySpanParentUuid = "SpanParentUuid"
	KeySpanRootUuid   = "SpanRootUuid"

	// Group messages for a given high level operation
	KeyOperationUuid  = "OperationUuid"
	KeyOperationLabel = "OperationLabel"

	KeyNode         = "Node"
	KeyNodeUuid     = "NodeUuid"
	KeyNodePath     = "NodePath"
	KeyTransferSize = "TransferSize"

	KeyWorkspace      = "Workspace"
	KeyWorkspaceUuid  = "WorkspaceUuid"
	KeyWorkspaceScope = "WorkspaceScope"

	KeyChangeLog        = "ChangeLog"
	KeyNodeChangeEvent  = "NodeChangeEvent"
	KeyVersioningPolicy = "VersioningPolicy"

	KeyActivitySubscription  = "ActivitySubscription"
	KeyActivityStreamRequest = "StreamActivitiesRequest"
	KeyActivityPostEvent     = "PostActivityEvent"
	KeyActivityObject        = "ActivityObject"

	KeyRole     = "Role"
	KeyRoleUuid = "RoleUuid"
	KeyRoles    = "Roles"
	KeyProfile  = "Profile"

	KeyUser     = "User"
	KeyUsername = "UserName"
	KeyUserUuid = "UserUuid"

	KeyGroupPath = "GroupPath"

	KeyConnector = "Connector"

	// Should be ACL and ACLID if we use proto names, changed to stay homogeneous with the other fields
	KeyAcl   = "Acl"
	KeyAclId = "AclId"

	// Pydio internal merged representation of all ACLs that a user has access to
	KeyAccessList = "AccessList"

	KeyPolicyGroup     = "PolicyGroup"
	KeyPolicyGroupUuid = "PolicyGroupUuid"
	KeyPolicy          = "Policy"
	KeyPolicyId        = "PolicyId"
	KeyPolicyRequest   = "PolicyRequest"

	// Scheduler
	KeyJob      = "Job"
	KeyJobId    = "JobId"
	KeyAction   = "Action"
	KeyActionId = "ActionId"
	KeyTask     = "Task"
	KeyTaskId   = "TaskId"
	// Running tasks in scheduler
	KeySchedulerJobId      = "SchedulerJobUuid"
	KeySchedulerTaskId     = "SchedulerTaskUuid"
	KeySchedulerActionPath = "SchedulerTaskActionPath"
	KeySchedulerActionTags = "SchedulerTaskActionTags"

	// Cells
	KeyCell     = "Cell"
	KeyCellUuid = "CellUuid"
	KeyLink     = "ShareLink"
	KeyLinkUuid = "ShareLinkUuid"

	// Chat
	KeyChatRoom        = "ChatRoom"
	KeyChatListRoomReq = "ChatListRoomRequest"
	KeyChatListMsgReq  = "ChatListMsgRequest"
	KeyChatPostMsgReq  = "ChatPostMsgRequest"
)

Known audit message IDs

View Source
const (
	KeyFrontIp      = "FrontIp"
	KeyFrontUserid  = "UserId"
	KeyFrontWksid   = "WorkspaceId"
	KeyFrontSource  = "Source"
	KeyFrontPrefix  = "Prefix"
	KeyFrontMessage = "Message"
	KeyFrontNodes   = "Nodes"
)

Keys for the front end

Variables

View Source
var (
	ServiceGrpcNamespace_    = "runtime.grpc."
	ServiceWebNamespace_     = "runtime.web."
	ServiceRestNamespace_    = "runtime.rest."
	ServiceGenericNamespace_ = "runtime.generic."

	ServiceRegistryGRPC = ServiceGrpcNamespace_ + ServiceRegistry
	ServiceBrokerGRPC   = ServiceGrpcNamespace_ + ServiceBroker
	ServiceConfigGRPC   = ServiceGrpcNamespace_ + ServiceConfig
	ServiceLogGRPC      = ServiceGrpcNamespace_ + ServiceLog

	TopicRegistryCommand = "runtime.registry.command"
	CtxCellsMetaPrefix   = "x-runtime-"
	PydioContextUserKey  = "runtime-user"
	XPydioSiteHash       = "X-Runtime-Site-Hash"
	XSpecialPydioHeaders []string
)
View Source
var (
	LogLevel  zapcore.Level
	LogJSON   bool
	LogToFile bool
)
View Source
var (
	ErrMissingDAO = errors.New("missing dao")
)
View Source
var (
	LogEventLabels = map[string]string{
		AuditLoginSucceed: "Login succeed",
		AuditLoginFailed:  "Login failed",
		AuditNodeCreate:   "Create Node",
		AuditNodeRead:     "Read Node",
		AuditNodeList:     "List Node",
		AuditNodeUpdate:   "Upadate Node",
		AuditNodeDelete:   "Delete Node",
		AuditObjectGet:    "Get Object",
		AuditObjectPut:    "Put Object",
	}
)

Functions

func ConfigureRuntimeNaming

func ConfigureRuntimeNaming(n RuntimeNaming)

ConfigureRuntimeNaming applies application protocol naming before runtime components are constructed.

Types

type ReaderMetaExtractor

type ReaderMetaExtractor interface {
	ExtractedMeta() (map[string]string, bool)
}

type RuntimeNaming

type RuntimeNaming struct {
	GRPCNamespace    string
	WebNamespace     string
	RESTNamespace    string
	GenericNamespace string
	RegistryTopic    string
	MetadataPrefix   string
	ContextUserKey   string
	SiteHashHeader   string
	ForwardedHeaders []string
}

RuntimeNaming contains application-owned protocol names used by generic infrastructure. Empty fields keep their current values.

type Scanner

type Scanner interface {
	Scan(val interface{}) error
}

type ServiceName

type ServiceName string

type ServiceTag

type ServiceTag string

type ServiceType

type ServiceType string

type XMLSerializableForm

type XMLSerializableForm interface {
	Serialize(languages ...string) interface{}
}

Directories

Path Synopsis
fsqueue
Package filepubsub provides an AsyncQueue adapter that wraps the gocloud pubsub file driver, enabling sync endpoints to use filesystem-backed pubsub queues.
Package filepubsub provides an AsyncQueue adapter that wraps the gocloud pubsub file driver, enabling sync endpoints to use filesystem-backed pubsub queues.
sql
Package crypto provides tools for data encryption and certificates management
Package crypto provides tools for data encryption and certificates management
storage
Package storage provide an URLOpener for certmagic.Storage interfaces
Package storage provide an URLOpener for certmagic.Storage interfaces
langerr
Package lang provides i18n strings related to activities
Package lang provides i18n strings related to activities
langerr/refresh command
examples
in-memory command
Command in-memory demonstrates using cells-runtime without the Cells application.
Command in-memory demonstrates using cells-runtime without the Cells application.
Package servicecontext performs context values read/write, generally through server or client wrappers
Package servicecontext performs context values read/write, generally through server or client wrappers
proto
log
service
Package service provides protobuf "any" types used by other proto's
Package service provides protobuf "any" types used by other proto's
sc
sql
Package telemetry groups all observability tools for application monitoring: logging, tracing, metrics and profiling
Package telemetry groups all observability tools for application monitoring: logging, tracing, metrics and profiling
log
Package log define and configure the Pydio loggers based on zap.
Package log define and configure the Pydio loggers based on zap.
metrics
Package metrics abstract various providers around OpenTelemetry metric.Reader
Package metrics abstract various providers around OpenTelemetry metric.Reader
metrics/otlp
Package otlp provides an OpenTelemetry protocol exporter for metrics
Package otlp provides an OpenTelemetry protocol exporter for metrics
metrics/prometheus
Package prometheus provides a Prometheus collector and the required cells HTTP services to expose metrics.
Package prometheus provides a Prometheus collector and the required cells HTTP services to expose metrics.
otel
Package otel groups together some common types for telemetry
Package otel groups together some common types for telemetry
profile
Package profile provides an abstraction of pprof profiles generations.
Package profile provides an abstraction of pprof profiles generations.
profile/http_pull
Package http_pull provides a profiling implementation that exposes PProf profiles on an HTTP endpoint
Package http_pull provides a profiling implementation that exposes PProf profiles on an HTTP endpoint
profile/pyroscope
Package pyroscope provides a Push-implementation of profiling traces to Grafana Pyroscope server
Package pyroscope provides a Push-implementation of profiling traces to Grafana Pyroscope server
tracing
Package tracing provides an abstraction of OpenTelemetry SpanExporter
Package tracing provides an abstraction of OpenTelemetry SpanExporter
tools
Package utils provides swiss-knife tools for all services
Package utils provides swiss-knife tools for all services
kv
net
Package net provides tools for reading IPs, available Ports, extending HTTP requests, etc.
Package net provides tools for reading IPs, available Ports, extending HTTP requests, etc.
openurl
Package openurl provides helpers for URLMux and URLOpeners in portable APIs.
Package openurl provides helpers for URLMux and URLOpeners in portable APIs.
schedule
Package schedule provides a fixed ticker based on a start time iso8601 interval periods are supported
Package schedule provides a fixed ticker based on a start time iso8601 interval periods are supported
std
Package std provides tools for standard types (strings, int, floats, etc).
Package std provides tools for standard types (strings, int, floats, etc).

Jump to

Keyboard shortcuts

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