tenant

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidScope      = errors.New("invalid scope")
	ErrInvalidTenantID   = errors.New("invalid tenant ID")
	ErrInvalidTeamID     = errors.New("invalid team ID")
	ErrInvalidProjectID  = errors.New("invalid project ID")
	ErrInvalidCollection = errors.New("invalid collection type")
	ErrAccessDenied      = errors.New("access denied")
)

Common errors.

Functions

func GetDefaultTenantID

func GetDefaultTenantID() string

GetDefaultTenantID returns the default tenant ID for single-tenant mode. Uses git user.name from global config if available, falls back to OS username.

func GetTenantIDForPath

func GetTenantIDForPath(repoPath string) string

GetTenantIDForPath returns a tenant ID, preferring GitHub username from repo remote. Priority: GitHub username from remote → git user.name → $USER → "local"

Types

type CollectionRouter deprecated

type CollectionRouter interface {
	// GetCollectionName returns the collection name for the given scope and identifiers.
	GetCollectionName(scope Scope, collectionType CollectionType, tenantID, teamID, projectID string) (string, error)

	// ValidateAccess verifies that the session has access to the specified collection.
	ValidateAccess(sessionTenantID, sessionTeamID, sessionProjectID, collectionName string) error

	// GetSearchCollections returns collections to search based on scope hierarchy.
	GetSearchCollections(scope Scope, collectionType CollectionType, tenantID, teamID, projectID string) ([]string, error)
}

CollectionRouter routes requests to the appropriate collection based on tenant scope.

Deprecated: With StoreProvider architecture, collection routing is no longer needed. StoreProvider handles database-per-project isolation, so services use simple collection names ("memories", "remediations", "codebase") within their scoped store.

Migration guide:

  • Instead of: router.GetCollectionName(ScopeProject, CollectionMemories, tenant, team, project)
  • Use: stores.GetProjectStore(ctx, tenant, team, project) then simple "memories" collection

This interface is retained for backward compatibility but will be removed in a future version.

func NewRouter deprecated

func NewRouter(strictMode bool) CollectionRouter

NewRouter creates a new collection router.

Deprecated: Use vectorstore.StoreProvider instead. StoreProvider provides database-per-project isolation which eliminates the need for collection routing.

type CollectionType

type CollectionType string

CollectionType represents the type of data stored in a collection.

const (
	CollectionMemories      CollectionType = "memories"
	CollectionRemediations  CollectionType = "remediations"
	CollectionCheckpoints   CollectionType = "checkpoints"
	CollectionPolicies      CollectionType = "policies"
	CollectionSkills        CollectionType = "skills"
	CollectionAgents        CollectionType = "agents"
	CollectionSessions      CollectionType = "sessions"
	CollectionCodebase      CollectionType = "codebase"
	CollectionStandards     CollectionType = "coding_standards"
	CollectionRepoStandards CollectionType = "repo_standards"
	CollectionAntiPatterns  CollectionType = "anti_patterns"
	CollectionFeedback      CollectionType = "feedback"
)

type Scope deprecated

type Scope string

Scope defines the hierarchy level for multi-tenant collections.

Deprecated: With the StoreProvider architecture (database-per-project isolation), scope is now handled at the store level, not collection level. Use vectorstore.StoreProvider.GetProjectStore/GetTeamStore/GetOrgStore instead.

const (
	// ScopeOrg indicates organization-level data (shared across all teams).
	ScopeOrg Scope = "org"
	// ScopeTeam indicates team-level data (shared within a team).
	ScopeTeam Scope = "team"
	// ScopeProject indicates project-level data (isolated per project).
	ScopeProject Scope = "project"
)

Jump to

Keyboard shortcuts

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