cloudserver

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDashboardSessionCodecRequired = errors.New("dashboard session codec is required for dashboard auth")

Functions

func PrincipalFromContext added in v1.18.0

func PrincipalFromContext(ctx context.Context) (cloudauth.Principal, bool)

func WithPrincipal added in v1.18.0

func WithPrincipal(ctx context.Context, principal cloudauth.Principal) context.Context

Types

type AdminIdentityStore added in v1.18.0

type AdminIdentityStore interface {
	CreateHumanUser(ctx context.Context, params cloudstore.CreateHumanUserParams) (cloudstore.HumanUser, error)
	ListHumanUsers(ctx context.Context) ([]cloudstore.HumanUser, error)
	SetHumanUserEnabled(ctx context.Context, principalID string, enabled bool) error
	CreatePrincipalTokenWithAudit(ctx context.Context, params cloudstore.CreatePrincipalTokenParams, audit cloudstore.AuthAuditEvent) (cloudstore.PrincipalToken, error)
	ListPrincipalTokens(ctx context.Context, principalID string) ([]cloudstore.PrincipalToken, error)
	RevokePrincipalToken(ctx context.Context, tokenID, revokedByPrincipalID, reason string) error
	CreateProjectGrant(ctx context.Context, params cloudstore.CreateProjectGrantParams) (cloudstore.ProjectGrant, error)
	ListProjectGrants(ctx context.Context, principalID string) ([]cloudstore.ProjectGrant, error)
	RevokeProjectGrant(ctx context.Context, principalID, project string) error
	InsertAuthAuditEvent(ctx context.Context, event cloudstore.AuthAuditEvent) error
}

AdminIdentityStore is the storage boundary used by cloudserver admin API handlers. CloudStore satisfies it through the identity methods added in the storage foundation slice.

type Authenticator added in v1.13.0

type Authenticator interface {
	Authorize(r *http.Request) error
}

type ChunkStore added in v1.13.0

type ChunkStore interface {
	ReadManifest(ctx context.Context, project string) (*engramsync.Manifest, error)
	WriteChunk(ctx context.Context, project, chunkID, createdBy, clientCreatedAt string, payload []byte) error
	ReadChunk(ctx context.Context, project, chunkID string) ([]byte, error)
	KnownSessionIDs(ctx context.Context, project string) (map[string]struct{}, error)
}

type CloudServer

type CloudServer struct {
	// contains filtered or unexported fields
}

func New

func New(store ChunkStore, authSvc Authenticator, port int, opts ...Option) *CloudServer

func (*CloudServer) Handler

func (s *CloudServer) Handler() http.Handler

func (*CloudServer) Start

func (s *CloudServer) Start() error

type EnrolledProjectsProvider added in v1.13.0

type EnrolledProjectsProvider interface {
	EnrolledProjects() []string
}

EnrolledProjectsProvider is an optional extension of ProjectAuthorizer that returns the list of enrolled projects for the authenticated caller.

type MutationEntry added in v1.13.0

type MutationEntry = cloudstore.MutationEntry

MutationEntry is an alias for cloudstore.MutationEntry (canonical wire type). Using a type alias ensures cloudstore.CloudStore satisfies MutationStore without adapter shims.

type MutationStore added in v1.13.0

type MutationStore interface {
	InsertMutationBatch(ctx context.Context, batch []cloudstore.MutationEntry) ([]int64, error)
	ListMutationsSince(ctx context.Context, sinceSeq int64, limit int, allowedProjects []string) ([]cloudstore.StoredMutation, bool, int64, error)
	IsProjectSyncEnabled(project string) (bool, error)
}

MutationStore is the subset of store methods needed by mutation handlers. It is satisfied by cloudstore.CloudStore and by test fakes. BC1: Using cloudstore types directly (via alias) ensures the type assertion s.store.(MutationStore) succeeds at runtime with a real *cloudstore.CloudStore.

type Option

type Option func(*CloudServer)

func WithAdminIdentityStore added in v1.18.0

func WithAdminIdentityStore(store AdminIdentityStore) Option

func WithDashboardAdminToken added in v1.13.0

func WithDashboardAdminToken(adminToken string) Option

func WithHost added in v1.13.0

func WithHost(host string) Option

func WithManagedTokenHasher added in v1.18.0

func WithManagedTokenHasher(hasher *cloudauth.ManagedTokenHasher) Option

func WithMaxPushBodyBytes added in v1.15.14

func WithMaxPushBodyBytes(limit int64) Option

func WithPrincipalProjectAuthorizer added in v1.18.0

func WithPrincipalProjectAuthorizer(authorizer PrincipalProjectAuthorizer) Option

func WithPrincipalStateStore added in v1.18.0

func WithPrincipalStateStore(store principalStateStore) Option

func WithProjectAuthorizer added in v1.13.0

func WithProjectAuthorizer(authorizer ProjectAuthorizer) Option

func WithSyncStatusProvider added in v1.13.0

func WithSyncStatusProvider(provider dashboard.SyncStatusProvider) Option

type PrincipalProjectAuthorizer added in v1.18.0

type PrincipalProjectAuthorizer interface {
	AuthorizeProjectForPrincipal(ctx context.Context, principal cloudauth.Principal, project string) error
	EnrolledProjectsForPrincipal(ctx context.Context, principal cloudauth.Principal) ([]string, error)
}

type ProjectAuthorizer added in v1.13.0

type ProjectAuthorizer interface {
	AuthorizeProject(project string) error
}

type StoredMutation added in v1.13.0

type StoredMutation = cloudstore.StoredMutation

StoredMutation is an alias for cloudstore.StoredMutation (canonical read type).

Jump to

Keyboard shortcuts

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