cloudserver

package
v2.0.0-rc.10 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 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

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

func WithPrincipal

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

Types

type AdminIdentityStore

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

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

type ChunkStore

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

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

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

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

func WithAdminIdentityStore(store AdminIdentityStore) Option

func WithDashboardAdminToken

func WithDashboardAdminToken(adminToken string) Option

func WithHost

func WithHost(host string) Option

func WithManagedTokenHasher

func WithManagedTokenHasher(hasher *cloudauth.ManagedTokenHasher) Option

func WithMaxPushBodyBytes

func WithMaxPushBodyBytes(limit int64) Option

func WithPrincipalProjectAuthorizer

func WithPrincipalProjectAuthorizer(authorizer PrincipalProjectAuthorizer) Option

func WithPrincipalStateStore

func WithPrincipalStateStore(store principalStateStore) Option

func WithProjectAuthorizer

func WithProjectAuthorizer(authorizer ProjectAuthorizer) Option

func WithSyncStatusProvider

func WithSyncStatusProvider(provider dashboard.SyncStatusProvider) Option

type PrincipalProjectAuthorizer

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

type ProjectAuthorizer

type ProjectAuthorizer interface {
	AuthorizeProject(project string) error
}

type StoredMutation

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