Documentation
¶
Index ¶
- Variables
- func DatabaseProvider() (*gorm.DB, error)
- func EventStoreProvider(db *gorm.DB) (*infrastructure.GormEventStore, error)
- func MigrateDatabaseWithProvider(db *sql.DB, provider SchemaProvider) error
- func NewDatabaseConnection(config DatabaseConfig) (*sql.DB, error)
- func NewEventDispatcher() (domain.EventDispatcher, error)
- func NewFileSystemContainerRepositoryProvider(config *conf.Container) (domain.ContainerRepository, error)
- func NewFileSystemRepositoryProvider() (domain.StreamingResourceRepository, error)
- func NewFileSystemRepositoryWithPath(basePath string) (domain.StreamingResourceRepository, error)
- func NewGORMContainerRepositoryProvider(db *gorm.DB) (domain.ContainerRepository, error)
- func NewOptimizedFileSystemRepositoryProvider() (domain.StreamingResourceRepository, error)
- func NewUnitOfWorkFactory(eventStore pericarpdomain.EventStore, ...) func() pericarpdomain.UnitOfWork
- type CacheConfig
- type CacheEntry
- type CachedContainerRepository
- func (r *CachedContainerRepository) AddMember(ctx context.Context, containerID, memberID string) error
- func (r *CachedContainerRepository) ContainerExists(ctx context.Context, id string) (bool, error)
- func (r *CachedContainerRepository) CreateContainer(ctx context.Context, container domain.ContainerResource) error
- func (r *CachedContainerRepository) DeleteContainer(ctx context.Context, id string) error
- func (r *CachedContainerRepository) FindByPath(ctx context.Context, path string) (domain.ContainerResource, error)
- func (r *CachedContainerRepository) GetChildren(ctx context.Context, containerID string) ([]domain.ContainerResource, error)
- func (r *CachedContainerRepository) GetContainer(ctx context.Context, id string) (domain.ContainerResource, error)
- func (r *CachedContainerRepository) GetParent(ctx context.Context, containerID string) (domain.ContainerResource, error)
- func (r *CachedContainerRepository) GetPath(ctx context.Context, containerID string) ([]string, error)
- func (r *CachedContainerRepository) ListMembers(ctx context.Context, containerID string, pagination domain.PaginationOptions) ([]string, error)
- func (r *CachedContainerRepository) RemoveMember(ctx context.Context, containerID, memberID string) error
- func (r *CachedContainerRepository) UpdateContainer(ctx context.Context, container *domain.Container) error
- type ContainerCache
- func (c *ContainerCache) Clear()
- func (c *ContainerCache) Get(containerID string) (*domain.Container, bool)
- func (c *ContainerCache) GetCacheStats() map[string]interface{}
- func (c *ContainerCache) GetStats(containerID string) (memberCount int, totalSize int64, found bool)
- func (c *ContainerCache) Invalidate(containerID string)
- func (c *ContainerCache) InvalidatePattern(pattern string)
- func (c *ContainerCache) Put(containerID string, container *domain.Container, memberCount int, ...)
- func (c *ContainerCache) Size() int
- func (c *ContainerCache) UpdateStats(containerID string, memberCount int, totalSize int64)
- type ContainerCacheEntry
- type ContainerMetadata
- type ContainerModel
- type ContainerRDFConverter
- func (c *ContainerRDFConverter) ConvertToJSONLD(container *domain.Container, baseURI string) ([]byte, error)
- func (c *ContainerRDFConverter) ConvertToRDFXML(container *domain.Container, baseURI string) ([]byte, error)
- func (c *ContainerRDFConverter) ConvertToTurtle(container *domain.Container, baseURI string) ([]byte, error)
- func (c *ContainerRDFConverter) GenerateMembershipTriples(container *domain.Container, baseURI string) []ContainerTriple
- type ContainerTriple
- type DatabaseConfig
- func DatabaseConfigFromEnv() DatabaseConfig
- func DefaultPostgresConfig(host, database, username, password string) DatabaseConfig
- func DefaultSQLiteConfig(dbPath string) DatabaseConfig
- func DevelopmentSQLiteConfig() DatabaseConfig
- func ProductionPostgreSQLConfig() DatabaseConfig
- func StagingPostgreSQLConfig() DatabaseConfig
- func TestSQLiteConfig() DatabaseConfig
- type FileSystemContainerRepository
- func (r *FileSystemContainerRepository) AddMember(ctx context.Context, containerID, memberID string) error
- func (r *FileSystemContainerRepository) ContainerExists(ctx context.Context, id string) (bool, error)
- func (r *FileSystemContainerRepository) CreateContainer(ctx context.Context, container domain.ContainerResource) error
- func (r *FileSystemContainerRepository) Delete(ctx context.Context, id string) error
- func (r *FileSystemContainerRepository) DeleteContainer(ctx context.Context, id string) error
- func (r *FileSystemContainerRepository) Exists(ctx context.Context, id string) (bool, error)
- func (r *FileSystemContainerRepository) FindByPath(ctx context.Context, path string) (domain.ContainerResource, error)
- func (r *FileSystemContainerRepository) GetChildren(ctx context.Context, containerID string) ([]domain.ContainerResource, error)
- func (r *FileSystemContainerRepository) GetContainer(ctx context.Context, id string) (domain.ContainerResource, error)
- func (r *FileSystemContainerRepository) GetParent(ctx context.Context, containerID string) (domain.ContainerResource, error)
- func (r *FileSystemContainerRepository) GetPath(ctx context.Context, containerID string) ([]string, error)
- func (r *FileSystemContainerRepository) ListMembers(ctx context.Context, containerID string, pagination domain.PaginationOptions) ([]string, error)
- func (r *FileSystemContainerRepository) RemoveMember(ctx context.Context, containerID, memberID string) error
- func (r *FileSystemContainerRepository) Retrieve(ctx context.Context, id string) (domain.Resource, error)
- func (r *FileSystemContainerRepository) RetrieveStream(ctx context.Context, id string) (io.ReadCloser, *domain.ResourceMetadata, error)
- func (r *FileSystemContainerRepository) Store(ctx context.Context, resource domain.Resource) error
- func (r *FileSystemContainerRepository) StoreStream(ctx context.Context, id string, reader io.Reader, contentType string, ...) error
- func (r *FileSystemContainerRepository) UpdateContainer(ctx context.Context, container domain.ContainerResource) error
- type FileSystemRepository
- func (r *FileSystemRepository) Delete(ctx context.Context, id string) error
- func (r *FileSystemRepository) Exists(ctx context.Context, id string) (bool, error)
- func (r *FileSystemRepository) Retrieve(ctx context.Context, id string) (domain.Resource, error)
- func (r *FileSystemRepository) RetrieveStream(ctx context.Context, id string) (io.ReadCloser, *domain.ResourceMetadata, error)
- func (r *FileSystemRepository) Store(ctx context.Context, resource domain.Resource) error
- func (r *FileSystemRepository) StoreStream(ctx context.Context, id string, reader io.Reader, contentType string, ...) error
- type FilterOptions
- type GORMContainerRepository
- func (r *GORMContainerRepository) AddMember(ctx context.Context, containerID, memberID string) error
- func (r *GORMContainerRepository) ContainerExists(ctx context.Context, id string) (bool, error)
- func (r *GORMContainerRepository) CreateContainer(ctx context.Context, container domain.ContainerResource) error
- func (r *GORMContainerRepository) Delete(ctx context.Context, id string) error
- func (r *GORMContainerRepository) DeleteContainer(ctx context.Context, id string) error
- func (r *GORMContainerRepository) Exists(ctx context.Context, id string) (bool, error)
- func (r *GORMContainerRepository) FindByPath(ctx context.Context, path string) (domain.ContainerResource, error)
- func (r *GORMContainerRepository) GetChildren(ctx context.Context, containerID string) ([]domain.ContainerResource, error)
- func (r *GORMContainerRepository) GetContainer(ctx context.Context, id string) (domain.ContainerResource, error)
- func (r *GORMContainerRepository) GetParent(ctx context.Context, containerID string) (domain.ContainerResource, error)
- func (r *GORMContainerRepository) GetPath(ctx context.Context, containerID string) ([]string, error)
- func (r *GORMContainerRepository) ListMembers(ctx context.Context, containerID string, pagination domain.PaginationOptions) ([]string, error)
- func (r *GORMContainerRepository) RemoveMember(ctx context.Context, containerID, memberID string) error
- func (r *GORMContainerRepository) Retrieve(ctx context.Context, id string) (domain.Resource, error)
- func (r *GORMContainerRepository) Store(ctx context.Context, resource domain.Resource) error
- func (r *GORMContainerRepository) UpdateContainer(ctx context.Context, container domain.ContainerResource) error
- type GenericMembershipIndexer
- func GenericMembershipIndexerProvider(config DatabaseConfig) (*GenericMembershipIndexer, error)
- func NewGenericMembershipIndexer(config DatabaseConfig) (*GenericMembershipIndexer, error)
- func PostgreSQLMembershipIndexerProvider(host, database, username, password string) (*GenericMembershipIndexer, error)
- func SQLiteMembershipIndexerProvider(basePath string) (*GenericMembershipIndexer, error)
- func (g *GenericMembershipIndexer) Close() error
- func (g *GenericMembershipIndexer) GetContainerStats(ctx context.Context, containerID string) (map[string]interface{}, error)
- func (g *GenericMembershipIndexer) GetContainers(ctx context.Context, memberID string) ([]string, error)
- func (g *GenericMembershipIndexer) GetMemberCount(ctx context.Context, containerID string) (int, error)
- func (g *GenericMembershipIndexer) GetMembers(ctx context.Context, containerID string, pagination PaginationOptions) ([]MemberInfo, error)
- func (g *GenericMembershipIndexer) IndexMembership(ctx context.Context, containerID, memberID string) error
- func (g *GenericMembershipIndexer) RebuildIndex(ctx context.Context) error
- func (g *GenericMembershipIndexer) RemoveMembership(ctx context.Context, containerID, memberID string) error
- type MemberInfo
- type MembershipIndexer
- type MembershipModel
- type OptimizedFileSystemRepository
- func (r *OptimizedFileSystemRepository) ClearCache(ctx context.Context)
- func (r *OptimizedFileSystemRepository) Delete(ctx context.Context, id string) error
- func (r *OptimizedFileSystemRepository) Exists(ctx context.Context, id string) (bool, error)
- func (r *OptimizedFileSystemRepository) FindByContentType(ctx context.Context, contentType string) ([]*domain.Resource, error)
- func (r *OptimizedFileSystemRepository) FindByTag(ctx context.Context, key, value string) ([]*domain.Resource, error)
- func (r *OptimizedFileSystemRepository) GetStats(ctx context.Context) map[string]interface{}
- func (r *OptimizedFileSystemRepository) ListResources(ctx context.Context, offset, limit int) ([]*domain.Resource, error)
- func (r *OptimizedFileSystemRepository) RebuildIndex(ctx context.Context) error
- func (r *OptimizedFileSystemRepository) Retrieve(ctx context.Context, id string) (*domain.Resource, error)
- func (r *OptimizedFileSystemRepository) RetrieveStream(ctx context.Context, id string) (io.ReadCloser, *domain.ResourceMetadata, error)
- func (r *OptimizedFileSystemRepository) Store(ctx context.Context, resource *domain.Resource) error
- func (r *OptimizedFileSystemRepository) StoreStream(ctx context.Context, id string, reader io.Reader, contentType string, ...) error
- func (r *OptimizedFileSystemRepository) WarmupCache(ctx context.Context) error
- type PaginationOptions
- type PostgreSQLSchemaProvider
- func (p *PostgreSQLSchemaProvider) CreateContainerSchema(db *sql.DB) error
- func (p *PostgreSQLSchemaProvider) CreateSchemaMigrationsTable(db *sql.DB) error
- func (p *PostgreSQLSchemaProvider) GetCurrentSchemaVersion(db *sql.DB) (int, error)
- func (p *PostgreSQLSchemaProvider) RecordMigration(db *sql.DB, version int, description string) error
- func (p *PostgreSQLSchemaProvider) ValidateSchema(db *sql.DB) error
- type RDFConverter
- type ResourceCache
- func (rc *ResourceCache) Clear(ctx context.Context)
- func (rc *ResourceCache) Get(ctx context.Context, id string) (*domain.Resource, bool)
- func (rc *ResourceCache) GetMostAccessed(limit int) []*CacheEntry
- func (rc *ResourceCache) GetStats() map[string]interface{}
- func (rc *ResourceCache) Put(ctx context.Context, resource *domain.Resource)
- func (rc *ResourceCache) Remove(ctx context.Context, id string)
- func (rc *ResourceCache) Warmup(ctx context.Context, resources []*domain.Resource)
- type ResourceIndex
- type ResourceIndexer
- func (ri *ResourceIndexer) AddResource(resource *domain.Resource) error
- func (ri *ResourceIndexer) FindByContentType(contentType string) []*ResourceIndex
- func (ri *ResourceIndexer) FindByID(id string) (*ResourceIndex, bool)
- func (ri *ResourceIndexer) FindBySizeRange(minSize, maxSize int) []*ResourceIndex
- func (ri *ResourceIndexer) FindByTag(key, value string) []*ResourceIndex
- func (ri *ResourceIndexer) GetStats() map[string]interface{}
- func (ri *ResourceIndexer) ListAll() []*ResourceIndex
- func (ri *ResourceIndexer) Rebuild(ctx context.Context) error
- func (ri *ResourceIndexer) RemoveResource(id string) error
- type ResourceMetadata
- type ResourceModel
- type ResourceType
- type SQLiteMembershipIndexer
- func (s *SQLiteMembershipIndexer) Close() error
- func (s *SQLiteMembershipIndexer) GetContainerStats(ctx context.Context, containerID string) (map[string]interface{}, error)
- func (s *SQLiteMembershipIndexer) GetContainers(ctx context.Context, memberID string) ([]string, error)
- func (s *SQLiteMembershipIndexer) GetDB() *sql.DB
- func (s *SQLiteMembershipIndexer) GetFilteredMemberCount(ctx context.Context, containerID string, filter FilterOptions) (int, error)
- func (s *SQLiteMembershipIndexer) GetMemberCount(ctx context.Context, containerID string) (int, error)
- func (s *SQLiteMembershipIndexer) GetMembers(ctx context.Context, containerID string, pagination PaginationOptions) ([]MemberInfo, error)
- func (s *SQLiteMembershipIndexer) GetMembersWithFiltering(ctx context.Context, containerID string, pagination PaginationOptions, ...) ([]MemberInfo, error)
- func (s *SQLiteMembershipIndexer) IndexMembership(ctx context.Context, containerID, memberID string) error
- func (s *SQLiteMembershipIndexer) RebuildIndex(ctx context.Context) error
- func (s *SQLiteMembershipIndexer) RemoveMembership(ctx context.Context, containerID, memberID string) error
- type SQLiteSchemaProvider
- func (p *SQLiteSchemaProvider) CreateContainerSchema(db *sql.DB) error
- func (p *SQLiteSchemaProvider) CreateSchemaMigrationsTable(db *sql.DB) error
- func (p *SQLiteSchemaProvider) GetCurrentSchemaVersion(db *sql.DB) (int, error)
- func (p *SQLiteSchemaProvider) RecordMigration(db *sql.DB, version int, description string) error
- func (p *SQLiteSchemaProvider) ValidateSchema(db *sql.DB) error
- type SchemaProvider
- type SortOptions
Constants ¶
This section is empty.
Variables ¶
var GenericMembershipIndexerSet = wire.NewSet( GenericMembershipIndexerProvider, wire.Bind(new(MembershipIndexer), new(*GenericMembershipIndexer)), )
GenericMembershipIndexerSet provides the generic membership indexer for Wire dependency injection
var InfrastructureSet = wire.NewSet( DatabaseProvider, EventStoreProvider, NewEventDispatcher, NewOptimizedFileSystemRepositoryProvider, NewGORMContainerRepositoryProvider, NewRDFConverter, NewContainerRDFConverter, NewUnitOfWorkFactory, wire.Bind(new(domain.FormatConverter), new(*RDFConverter)), wire.Bind(new(pericarpdomain.EventStore), new(*pericarpinfra.GormEventStore)), wire.Bind(new(domain.ContainerRepository), new(*GORMContainerRepository)), )
InfrastructureSet provides all infrastructure dependencies
var MembershipIndexerSet = wire.NewSet( MembershipIndexerProvider, wire.Bind(new(MembershipIndexer), new(*SQLiteMembershipIndexer)), )
MembershipIndexerSet provides the membership indexer for Wire dependency injection
var OptimizedInfrastructureSet = wire.NewSet( DatabaseProvider, EventStoreProvider, NewEventDispatcher, NewOptimizedFileSystemRepositoryProvider, NewGORMContainerRepositoryProvider, NewRDFConverter, NewContainerRDFConverter, NewUnitOfWorkFactory, wire.Bind(new(domain.FormatConverter), new(*RDFConverter)), wire.Bind(new(pericarpdomain.EventStore), new(*pericarpinfra.GormEventStore)), wire.Bind(new(domain.ContainerRepository), new(*GORMContainerRepository)), )
OptimizedInfrastructureSet provides optimized infrastructure dependencies with caching and indexing
var PostgreSQLMembershipIndexerSet = wire.NewSet( PostgreSQLMembershipIndexerProvider, wire.Bind(new(MembershipIndexer), new(*GenericMembershipIndexer)), )
PostgreSQLMembershipIndexerSet provides PostgreSQL-specific membership indexer
var SQLiteMembershipIndexerSet = wire.NewSet( SQLiteMembershipIndexerProvider, wire.Bind(new(MembershipIndexer), new(*GenericMembershipIndexer)), )
SQLiteMembershipIndexerSet provides SQLite-specific membership indexer
var SupportedFormats = map[string]bool{ "application/ld+json": true, "text/turtle": true, "application/rdf+xml": true, "application/json": true, "text/plain": true, }
SupportedFormats defines the RDF formats supported by the converter
Functions ¶
func DatabaseProvider ¶
DatabaseProvider creates a GORM database instance using pericarp's database setup
func EventStoreProvider ¶
func EventStoreProvider(db *gorm.DB) (*infrastructure.GormEventStore, error)
EventStoreProvider creates a GormEventStore using pericarp's implementation
func MigrateDatabaseWithProvider ¶
func MigrateDatabaseWithProvider(db *sql.DB, provider SchemaProvider) error
MigrateDatabase applies all pending migrations using the appropriate schema provider
func NewDatabaseConnection ¶
func NewDatabaseConnection(config DatabaseConfig) (*sql.DB, error)
NewDatabaseConnection creates a database connection based on configuration
func NewEventDispatcher ¶
func NewEventDispatcher() (domain.EventDispatcher, error)
NewEventDispatcher creates a new WatermillEventDispatcher instance using pericarp
func NewFileSystemContainerRepositoryProvider ¶
func NewFileSystemContainerRepositoryProvider(config *conf.Container) (domain.ContainerRepository, error)
NewFileSystemContainerRepositoryProvider provides a FileSystemContainerRepository for Wire dependency injection
func NewFileSystemRepositoryProvider ¶
func NewFileSystemRepositoryProvider() (domain.StreamingResourceRepository, error)
NewFileSystemRepositoryProvider provides a FileSystemRepository for Wire dependency injection This function uses a default base path for the repository
func NewFileSystemRepositoryWithPath ¶
func NewFileSystemRepositoryWithPath(basePath string) (domain.StreamingResourceRepository, error)
NewFileSystemRepositoryWithPath provides a FileSystemRepository with a specific base path
func NewGORMContainerRepositoryProvider ¶
func NewGORMContainerRepositoryProvider(db *gorm.DB) (domain.ContainerRepository, error)
NewGORMContainerRepositoryProvider provides a GORMContainerRepository for Wire dependency injection
func NewOptimizedFileSystemRepositoryProvider ¶
func NewOptimizedFileSystemRepositoryProvider() (domain.StreamingResourceRepository, error)
NewOptimizedFileSystemRepositoryProvider provides an OptimizedFileSystemRepository for Wire
func NewUnitOfWorkFactory ¶
func NewUnitOfWorkFactory( eventStore pericarpdomain.EventStore, eventDispatcher pericarpdomain.EventDispatcher, ) func() pericarpdomain.UnitOfWork
NewUnitOfWorkFactory creates a factory function for creating UnitOfWork instances
Types ¶
type CacheConfig ¶
type CacheConfig struct {
MaxSize int64 // Maximum cache size in bytes (default: 100MB)
MaxEntries int // Maximum number of entries (default: 1000)
TTL time.Duration // Time to live (default: 1 hour)
}
CacheConfig holds configuration for the resource cache
type CacheEntry ¶
CacheEntry represents a cached resource with metadata
type CachedContainerRepository ¶
type CachedContainerRepository struct {
// contains filtered or unexported fields
}
CachedContainerRepository wraps a container repository with caching
func NewCachedContainerRepository ¶
func NewCachedContainerRepository(repo domain.ContainerRepository, cache *ContainerCache) *CachedContainerRepository
NewCachedContainerRepository creates a new cached container repository
func (*CachedContainerRepository) AddMember ¶
func (r *CachedContainerRepository) AddMember(ctx context.Context, containerID, memberID string) error
AddMember adds a member and invalidates container cache
func (*CachedContainerRepository) ContainerExists ¶
ContainerExists checks existence (no caching for dynamic results)
func (*CachedContainerRepository) CreateContainer ¶
func (r *CachedContainerRepository) CreateContainer(ctx context.Context, container domain.ContainerResource) error
CreateContainer creates a container and invalidates cache
func (*CachedContainerRepository) DeleteContainer ¶
func (r *CachedContainerRepository) DeleteContainer(ctx context.Context, id string) error
DeleteContainer deletes a container and invalidates cache
func (*CachedContainerRepository) FindByPath ¶
func (r *CachedContainerRepository) FindByPath(ctx context.Context, path string) (domain.ContainerResource, error)
FindByPath finds by path (no caching for dynamic results)
func (*CachedContainerRepository) GetChildren ¶
func (r *CachedContainerRepository) GetChildren(ctx context.Context, containerID string) ([]domain.ContainerResource, error)
GetChildren gets children (no caching for dynamic results)
func (*CachedContainerRepository) GetContainer ¶
func (r *CachedContainerRepository) GetContainer(ctx context.Context, id string) (domain.ContainerResource, error)
GetContainer retrieves a container with caching
func (*CachedContainerRepository) GetParent ¶
func (r *CachedContainerRepository) GetParent(ctx context.Context, containerID string) (domain.ContainerResource, error)
GetParent gets parent with caching
func (*CachedContainerRepository) GetPath ¶
func (r *CachedContainerRepository) GetPath(ctx context.Context, containerID string) ([]string, error)
GetPath gets path (no caching for dynamic results)
func (*CachedContainerRepository) ListMembers ¶
func (r *CachedContainerRepository) ListMembers(ctx context.Context, containerID string, pagination domain.PaginationOptions) ([]string, error)
ListMembers lists members (no caching for dynamic results)
func (*CachedContainerRepository) RemoveMember ¶
func (r *CachedContainerRepository) RemoveMember(ctx context.Context, containerID, memberID string) error
RemoveMember removes a member and invalidates container cache
func (*CachedContainerRepository) UpdateContainer ¶
func (r *CachedContainerRepository) UpdateContainer(ctx context.Context, container *domain.Container) error
UpdateContainer updates a container and invalidates cache
type ContainerCache ¶
type ContainerCache struct {
// contains filtered or unexported fields
}
ContainerCache provides caching for container data and statistics
func NewContainerCache ¶
func NewContainerCache(ttl time.Duration, maxEntries int) *ContainerCache
NewContainerCache creates a new container cache
func (*ContainerCache) Clear ¶
func (c *ContainerCache) Clear()
Clear removes all entries from cache
func (*ContainerCache) Get ¶
func (c *ContainerCache) Get(containerID string) (*domain.Container, bool)
Get retrieves a container from cache
func (*ContainerCache) GetCacheStats ¶
func (c *ContainerCache) GetCacheStats() map[string]interface{}
GetCacheStats returns cache statistics
func (*ContainerCache) GetStats ¶
func (c *ContainerCache) GetStats(containerID string) (memberCount int, totalSize int64, found bool)
GetStats retrieves cached statistics for a container
func (*ContainerCache) Invalidate ¶
func (c *ContainerCache) Invalidate(containerID string)
Invalidate removes a container from cache
func (*ContainerCache) InvalidatePattern ¶
func (c *ContainerCache) InvalidatePattern(pattern string)
InvalidatePattern removes containers matching a pattern from cache
func (*ContainerCache) Put ¶
func (c *ContainerCache) Put(containerID string, container *domain.Container, memberCount int, totalSize int64)
Put stores a container in cache
func (*ContainerCache) Size ¶
func (c *ContainerCache) Size() int
Size returns the number of entries in cache
func (*ContainerCache) UpdateStats ¶
func (c *ContainerCache) UpdateStats(containerID string, memberCount int, totalSize int64)
UpdateStats updates cached statistics for a container
type ContainerCacheEntry ¶
type ContainerCacheEntry struct {
Container *domain.Container
MemberCount int
TotalSize int64
LastAccessed time.Time
ExpiresAt time.Time
}
ContainerCacheEntry represents a cached container entry
func (*ContainerCacheEntry) IsExpired ¶
func (e *ContainerCacheEntry) IsExpired() bool
IsExpired checks if the cache entry has expired
type ContainerMetadata ¶
type ContainerMetadata struct {
ID string `json:"id"`
ParentID string `json:"parentId"`
ContainerType string `json:"containerType"`
Title string `json:"title"`
Description string `json:"description"`
Members []string `json:"members"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
ContainerMetadata represents the metadata stored for a container
type ContainerModel ¶
type ContainerModel struct {
ID string `gorm:"primaryKey;type:varchar(255)"`
ParentID *string `gorm:"type:varchar(255);index"`
Parent *ContainerModel `gorm:"foreignKey:ParentID;references:ID;constraint:OnDelete:CASCADE"`
Type string `gorm:"not null;type:varchar(50);default:'BasicContainer'"`
Title string `gorm:"type:varchar(255)"`
Description string `gorm:"type:text"`
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
// Relationships
Children []ContainerModel `gorm:"foreignKey:ParentID;references:ID"`
Resources []ResourceModel `gorm:"foreignKey:ContainerID;references:ID"`
}
ContainerModel represents the GORM model for containers
func (*ContainerModel) BeforeCreate ¶
func (c *ContainerModel) BeforeCreate(tx *gorm.DB) error
BeforeCreate GORM hook for validation before creation
func (*ContainerModel) BeforeUpdate ¶
func (c *ContainerModel) BeforeUpdate(tx *gorm.DB) error
BeforeUpdate GORM hook for updating timestamps
func (ContainerModel) TableName ¶
func (ContainerModel) TableName() string
TableName specifies the table name for ContainerModel
type ContainerRDFConverter ¶
type ContainerRDFConverter struct {
// contains filtered or unexported fields
}
ContainerRDFConverter handles conversion of container entities to various RDF formats
func NewContainerRDFConverter ¶
func NewContainerRDFConverter() *ContainerRDFConverter
NewContainerRDFConverter creates a new container RDF converter
func (*ContainerRDFConverter) ConvertToJSONLD ¶
func (c *ContainerRDFConverter) ConvertToJSONLD(container *domain.Container, baseURI string) ([]byte, error)
ConvertToJSONLD converts a container to JSON-LD format
func (*ContainerRDFConverter) ConvertToRDFXML ¶
func (c *ContainerRDFConverter) ConvertToRDFXML(container *domain.Container, baseURI string) ([]byte, error)
ConvertToRDFXML converts a container to RDF/XML format
func (*ContainerRDFConverter) ConvertToTurtle ¶
func (c *ContainerRDFConverter) ConvertToTurtle(container *domain.Container, baseURI string) ([]byte, error)
ConvertToTurtle converts a container to Turtle format
func (*ContainerRDFConverter) GenerateMembershipTriples ¶
func (c *ContainerRDFConverter) GenerateMembershipTriples(container *domain.Container, baseURI string) []ContainerTriple
GenerateMembershipTriples generates LDP membership triples for a container
type ContainerTriple ¶
type ContainerTriple struct {
Subject string `json:"subject"`
Predicate string `json:"predicate"`
Object string `json:"object"`
ObjectType string `json:"objectType"` // "uri", "literal", "blank"
DataType string `json:"dataType,omitempty"`
}
ContainerTriple represents an RDF triple for container serialization
type DatabaseConfig ¶
type DatabaseConfig struct {
Driver string // "sqlite3" or "postgres"
Host string // PostgreSQL host (ignored for SQLite)
Port int // PostgreSQL port (ignored for SQLite)
Database string // Database name or SQLite file path
Username string // PostgreSQL username (ignored for SQLite)
Password string // PostgreSQL password (ignored for SQLite)
SSLMode string // PostgreSQL SSL mode (ignored for SQLite)
}
DatabaseConfig holds database connection configuration
func DatabaseConfigFromEnv ¶
func DatabaseConfigFromEnv() DatabaseConfig
DatabaseConfigFromEnv creates a database configuration from environment variables
func DefaultPostgresConfig ¶
func DefaultPostgresConfig(host, database, username, password string) DatabaseConfig
DefaultPostgresConfig returns a default PostgreSQL configuration
func DefaultSQLiteConfig ¶
func DefaultSQLiteConfig(dbPath string) DatabaseConfig
DefaultSQLiteConfig returns a default SQLite configuration
func DevelopmentSQLiteConfig ¶
func DevelopmentSQLiteConfig() DatabaseConfig
DevelopmentSQLiteConfig returns a SQLite configuration for development
func ProductionPostgreSQLConfig ¶
func ProductionPostgreSQLConfig() DatabaseConfig
ProductionPostgreSQLConfig returns a PostgreSQL configuration for production
func StagingPostgreSQLConfig ¶
func StagingPostgreSQLConfig() DatabaseConfig
StagingPostgreSQLConfig returns a PostgreSQL configuration for staging
func TestSQLiteConfig ¶
func TestSQLiteConfig() DatabaseConfig
TestSQLiteConfig returns a SQLite configuration for testing
type FileSystemContainerRepository ¶
type FileSystemContainerRepository struct {
*FileSystemRepository // Inherits base filesystem operations
// contains filtered or unexported fields
}
FileSystemContainerRepository implements ContainerRepository using filesystem storage
func NewFileSystemContainerRepository ¶
func NewFileSystemContainerRepository(basePath string, indexer MembershipIndexer) (*FileSystemContainerRepository, error)
NewFileSystemContainerRepository creates a new FileSystemContainerRepository
func (*FileSystemContainerRepository) AddMember ¶
func (r *FileSystemContainerRepository) AddMember(ctx context.Context, containerID, memberID string) error
AddMember adds a member to a container
func (*FileSystemContainerRepository) ContainerExists ¶
func (r *FileSystemContainerRepository) ContainerExists(ctx context.Context, id string) (bool, error)
ContainerExists checks if a container exists
func (*FileSystemContainerRepository) CreateContainer ¶
func (r *FileSystemContainerRepository) CreateContainer(ctx context.Context, container domain.ContainerResource) error
CreateContainer creates a new container in the filesystem
func (*FileSystemContainerRepository) Delete ¶
func (r *FileSystemContainerRepository) Delete(ctx context.Context, id string) error
Delete deletes a resource (delegates to base repository)
func (*FileSystemContainerRepository) DeleteContainer ¶
func (r *FileSystemContainerRepository) DeleteContainer(ctx context.Context, id string) error
DeleteContainer deletes a container from the filesystem
func (*FileSystemContainerRepository) Exists ¶
Exists checks if a resource exists (delegates to base repository)
func (*FileSystemContainerRepository) FindByPath ¶
func (r *FileSystemContainerRepository) FindByPath(ctx context.Context, path string) (domain.ContainerResource, error)
FindByPath finds a container by its path
func (*FileSystemContainerRepository) GetChildren ¶
func (r *FileSystemContainerRepository) GetChildren(ctx context.Context, containerID string) ([]domain.ContainerResource, error)
GetChildren returns all child containers of a container
func (*FileSystemContainerRepository) GetContainer ¶
func (r *FileSystemContainerRepository) GetContainer(ctx context.Context, id string) (domain.ContainerResource, error)
GetContainer retrieves a container from the filesystem
func (*FileSystemContainerRepository) GetParent ¶
func (r *FileSystemContainerRepository) GetParent(ctx context.Context, containerID string) (domain.ContainerResource, error)
GetParent returns the parent container of a container
func (*FileSystemContainerRepository) GetPath ¶
func (r *FileSystemContainerRepository) GetPath(ctx context.Context, containerID string) ([]string, error)
GetPath returns the path to a container as a slice of container IDs
func (*FileSystemContainerRepository) ListMembers ¶
func (r *FileSystemContainerRepository) ListMembers(ctx context.Context, containerID string, pagination domain.PaginationOptions) ([]string, error)
ListMembers lists all members of a container
func (*FileSystemContainerRepository) RemoveMember ¶
func (r *FileSystemContainerRepository) RemoveMember(ctx context.Context, containerID, memberID string) error
RemoveMember removes a member from a container
func (*FileSystemContainerRepository) Retrieve ¶
func (r *FileSystemContainerRepository) Retrieve(ctx context.Context, id string) (domain.Resource, error)
Retrieve retrieves a resource (delegates to base repository)
func (*FileSystemContainerRepository) RetrieveStream ¶
func (r *FileSystemContainerRepository) RetrieveStream(ctx context.Context, id string) (io.ReadCloser, *domain.ResourceMetadata, error)
RetrieveStream retrieves a resource as a stream (delegates to base repository)
func (*FileSystemContainerRepository) Store ¶
Store stores a resource (delegates to base repository)
func (*FileSystemContainerRepository) StoreStream ¶
func (r *FileSystemContainerRepository) StoreStream(ctx context.Context, id string, reader io.Reader, contentType string, size int64) error
StoreStream stores a resource from a stream (delegates to base repository)
func (*FileSystemContainerRepository) UpdateContainer ¶
func (r *FileSystemContainerRepository) UpdateContainer(ctx context.Context, container domain.ContainerResource) error
UpdateContainer updates an existing container
type FileSystemRepository ¶
type FileSystemRepository struct {
// contains filtered or unexported fields
}
FileSystemRepository implements StreamingResourceRepository using file system storage
func NewFileSystemRepository ¶
func NewFileSystemRepository(basePath string) (*FileSystemRepository, error)
NewFileSystemRepository creates a new FileSystemRepository
func (*FileSystemRepository) Delete ¶
func (r *FileSystemRepository) Delete(ctx context.Context, id string) error
Delete removes a resource from the file system
func (*FileSystemRepository) Retrieve ¶
Retrieve loads a resource from the file system with checksum validation
func (*FileSystemRepository) RetrieveStream ¶
func (r *FileSystemRepository) RetrieveStream(ctx context.Context, id string) (io.ReadCloser, *domain.ResourceMetadata, error)
RetrieveStream retrieves a resource as a stream for efficient memory usage
type FilterOptions ¶
type FilterOptions struct {
MemberType string `json:"memberType,omitempty"` // "Container" or "Resource"
ContentType string `json:"contentType,omitempty"` // MIME type filter
NamePattern string `json:"namePattern,omitempty"` // Name pattern matching
CreatedAfter *time.Time `json:"createdAfter,omitempty"` // Created after timestamp
CreatedBefore *time.Time `json:"createdBefore,omitempty"` // Created before timestamp
SizeMin *int64 `json:"sizeMin,omitempty"` // Minimum size in bytes
SizeMax *int64 `json:"sizeMax,omitempty"` // Maximum size in bytes
}
FilterOptions represents filtering options for container members
type GORMContainerRepository ¶
type GORMContainerRepository struct {
// contains filtered or unexported fields
}
GORMContainerRepository implements ContainerRepository using GORM
func NewGORMContainerRepository ¶
func NewGORMContainerRepository(db *gorm.DB) (*GORMContainerRepository, error)
NewGORMContainerRepository creates a new GORM-based container repository
func (*GORMContainerRepository) AddMember ¶
func (r *GORMContainerRepository) AddMember(ctx context.Context, containerID, memberID string) error
AddMember implements ContainerRepository.AddMember
func (*GORMContainerRepository) ContainerExists ¶
ContainerExists implements ContainerRepository.ContainerExists
func (*GORMContainerRepository) CreateContainer ¶
func (r *GORMContainerRepository) CreateContainer(ctx context.Context, container domain.ContainerResource) error
CreateContainer implements ContainerRepository.CreateContainer
func (*GORMContainerRepository) Delete ¶
func (r *GORMContainerRepository) Delete(ctx context.Context, id string) error
Delete implements ResourceRepository.Delete
func (*GORMContainerRepository) DeleteContainer ¶
func (r *GORMContainerRepository) DeleteContainer(ctx context.Context, id string) error
DeleteContainer implements ContainerRepository.DeleteContainer
func (*GORMContainerRepository) FindByPath ¶
func (r *GORMContainerRepository) FindByPath(ctx context.Context, path string) (domain.ContainerResource, error)
FindByPath implements ContainerRepository.FindByPath
func (*GORMContainerRepository) GetChildren ¶
func (r *GORMContainerRepository) GetChildren(ctx context.Context, containerID string) ([]domain.ContainerResource, error)
GetChildren implements ContainerRepository.GetChildren
func (*GORMContainerRepository) GetContainer ¶
func (r *GORMContainerRepository) GetContainer(ctx context.Context, id string) (domain.ContainerResource, error)
GetContainer implements ContainerRepository.GetContainer
func (*GORMContainerRepository) GetParent ¶
func (r *GORMContainerRepository) GetParent(ctx context.Context, containerID string) (domain.ContainerResource, error)
GetParent implements ContainerRepository.GetParent
func (*GORMContainerRepository) GetPath ¶
func (r *GORMContainerRepository) GetPath(ctx context.Context, containerID string) ([]string, error)
GetPath implements ContainerRepository.GetPath
func (*GORMContainerRepository) ListMembers ¶
func (r *GORMContainerRepository) ListMembers(ctx context.Context, containerID string, pagination domain.PaginationOptions) ([]string, error)
ListMembers implements ContainerRepository.ListMembers
func (*GORMContainerRepository) RemoveMember ¶
func (r *GORMContainerRepository) RemoveMember(ctx context.Context, containerID, memberID string) error
RemoveMember implements ContainerRepository.RemoveMember
func (*GORMContainerRepository) UpdateContainer ¶
func (r *GORMContainerRepository) UpdateContainer(ctx context.Context, container domain.ContainerResource) error
UpdateContainer implements ContainerRepository.UpdateContainer
type GenericMembershipIndexer ¶
type GenericMembershipIndexer struct {
// contains filtered or unexported fields
}
GenericMembershipIndexer implements MembershipIndexer for multiple database types
func GenericMembershipIndexerProvider ¶
func GenericMembershipIndexerProvider(config DatabaseConfig) (*GenericMembershipIndexer, error)
GenericMembershipIndexerProvider creates a GenericMembershipIndexer instance
func NewGenericMembershipIndexer ¶
func NewGenericMembershipIndexer(config DatabaseConfig) (*GenericMembershipIndexer, error)
NewGenericMembershipIndexer creates a new database-agnostic membership indexer
func PostgreSQLMembershipIndexerProvider ¶
func PostgreSQLMembershipIndexerProvider(host, database, username, password string) (*GenericMembershipIndexer, error)
PostgreSQLMembershipIndexerProvider creates a PostgreSQL-specific membership indexer
func SQLiteMembershipIndexerProvider ¶
func SQLiteMembershipIndexerProvider(basePath string) (*GenericMembershipIndexer, error)
SQLiteMembershipIndexerProvider creates a SQLite-specific membership indexer
func (*GenericMembershipIndexer) Close ¶
func (g *GenericMembershipIndexer) Close() error
Close closes the database connection
func (*GenericMembershipIndexer) GetContainerStats ¶
func (g *GenericMembershipIndexer) GetContainerStats(ctx context.Context, containerID string) (map[string]interface{}, error)
GetContainerStats returns statistics about a container
func (*GenericMembershipIndexer) GetContainers ¶
func (g *GenericMembershipIndexer) GetContainers(ctx context.Context, memberID string) ([]string, error)
GetContainers retrieves all containers that contain a specific member
func (*GenericMembershipIndexer) GetMemberCount ¶
func (g *GenericMembershipIndexer) GetMemberCount(ctx context.Context, containerID string) (int, error)
GetMemberCount returns the total number of members in a container
func (*GenericMembershipIndexer) GetMembers ¶
func (g *GenericMembershipIndexer) GetMembers(ctx context.Context, containerID string, pagination PaginationOptions) ([]MemberInfo, error)
GetMembers retrieves all members of a container with pagination
func (*GenericMembershipIndexer) IndexMembership ¶
func (g *GenericMembershipIndexer) IndexMembership(ctx context.Context, containerID, memberID string) error
IndexMembership adds a membership relationship to the index
func (*GenericMembershipIndexer) RebuildIndex ¶
func (g *GenericMembershipIndexer) RebuildIndex(ctx context.Context) error
RebuildIndex rebuilds the membership index from scratch
func (*GenericMembershipIndexer) RemoveMembership ¶
func (g *GenericMembershipIndexer) RemoveMembership(ctx context.Context, containerID, memberID string) error
RemoveMembership removes a membership relationship from the index
type MemberInfo ¶
type MemberInfo struct {
ID string
Type ResourceType
ContentType string
Size int64
CreatedAt time.Time
UpdatedAt time.Time
}
MemberInfo contains information about a container member
type MembershipIndexer ¶
type MembershipIndexer interface {
IndexMembership(ctx context.Context, containerID, memberID string) error
RemoveMembership(ctx context.Context, containerID, memberID string) error
GetMembers(ctx context.Context, containerID string, pagination PaginationOptions) ([]MemberInfo, error)
GetContainers(ctx context.Context, memberID string) ([]string, error)
RebuildIndex(ctx context.Context) error
Close() error
}
MembershipIndexer defines the interface for container membership indexing
type MembershipModel ¶
type MembershipModel struct {
ContainerID string `gorm:"primaryKey;type:varchar(255)"`
MemberID string `gorm:"primaryKey;type:varchar(255)"`
MemberType string `gorm:"not null;type:varchar(50)"` // "Container" or "Resource"
CreatedAt time.Time `gorm:"not null"`
// Relationships
Container ContainerModel `gorm:"foreignKey:ContainerID;references:ID;constraint:OnDelete:CASCADE"`
}
MembershipModel represents the GORM model for container membership relationships
func (*MembershipModel) BeforeCreate ¶
func (m *MembershipModel) BeforeCreate(tx *gorm.DB) error
BeforeCreate GORM hook for validation before creation
func (MembershipModel) TableName ¶
func (MembershipModel) TableName() string
TableName specifies the table name for MembershipModel
type OptimizedFileSystemRepository ¶
type OptimizedFileSystemRepository struct {
*FileSystemRepository
// contains filtered or unexported fields
}
OptimizedFileSystemRepository extends FileSystemRepository with indexing and caching
func NewOptimizedFileSystemRepository ¶
func NewOptimizedFileSystemRepository(basePath string, cacheConfig CacheConfig) (*OptimizedFileSystemRepository, error)
NewOptimizedFileSystemRepository creates a new optimized repository with indexing and caching
func (*OptimizedFileSystemRepository) ClearCache ¶
func (r *OptimizedFileSystemRepository) ClearCache(ctx context.Context)
ClearCache clears the resource cache
func (*OptimizedFileSystemRepository) Delete ¶
func (r *OptimizedFileSystemRepository) Delete(ctx context.Context, id string) error
Delete removes a resource with index and cache cleanup
func (*OptimizedFileSystemRepository) Exists ¶
Exists checks if a resource exists using index for fast lookup
func (*OptimizedFileSystemRepository) FindByContentType ¶
func (r *OptimizedFileSystemRepository) FindByContentType(ctx context.Context, contentType string) ([]*domain.Resource, error)
FindByContentType finds resources by content type using index
func (*OptimizedFileSystemRepository) FindByTag ¶
func (r *OptimizedFileSystemRepository) FindByTag(ctx context.Context, key, value string) ([]*domain.Resource, error)
FindByTag finds resources by tag using index
func (*OptimizedFileSystemRepository) GetStats ¶
func (r *OptimizedFileSystemRepository) GetStats(ctx context.Context) map[string]interface{}
GetStats returns combined statistics from repository, index, and cache
func (*OptimizedFileSystemRepository) ListResources ¶
func (r *OptimizedFileSystemRepository) ListResources(ctx context.Context, offset, limit int) ([]*domain.Resource, error)
ListResources returns a paginated list of resources using index
func (*OptimizedFileSystemRepository) RebuildIndex ¶
func (r *OptimizedFileSystemRepository) RebuildIndex(ctx context.Context) error
RebuildIndex rebuilds the resource index
func (*OptimizedFileSystemRepository) Retrieve ¶
func (r *OptimizedFileSystemRepository) Retrieve(ctx context.Context, id string) (*domain.Resource, error)
Retrieve loads a resource with cache-first lookup and index optimization
func (*OptimizedFileSystemRepository) RetrieveStream ¶
func (r *OptimizedFileSystemRepository) RetrieveStream(ctx context.Context, id string) (io.ReadCloser, *domain.ResourceMetadata, error)
RetrieveStream retrieves a resource as a stream (delegates to base repository)
func (*OptimizedFileSystemRepository) Store ¶
Store saves a resource with optimized indexing and cache invalidation
func (*OptimizedFileSystemRepository) StoreStream ¶
func (r *OptimizedFileSystemRepository) StoreStream(ctx context.Context, id string, reader io.Reader, contentType string, size int64) error
StoreStream stores a resource from a stream (delegates to base repository)
func (*OptimizedFileSystemRepository) WarmupCache ¶
func (r *OptimizedFileSystemRepository) WarmupCache(ctx context.Context) error
WarmupCache preloads frequently accessed resources into cache
type PaginationOptions ¶
PaginationOptions contains pagination parameters
type PostgreSQLSchemaProvider ¶
type PostgreSQLSchemaProvider struct{}
PostgreSQLSchemaProvider implements schema operations for PostgreSQL
func (*PostgreSQLSchemaProvider) CreateContainerSchema ¶
func (p *PostgreSQLSchemaProvider) CreateContainerSchema(db *sql.DB) error
func (*PostgreSQLSchemaProvider) CreateSchemaMigrationsTable ¶
func (p *PostgreSQLSchemaProvider) CreateSchemaMigrationsTable(db *sql.DB) error
func (*PostgreSQLSchemaProvider) GetCurrentSchemaVersion ¶
func (p *PostgreSQLSchemaProvider) GetCurrentSchemaVersion(db *sql.DB) (int, error)
func (*PostgreSQLSchemaProvider) RecordMigration ¶
func (*PostgreSQLSchemaProvider) ValidateSchema ¶
func (p *PostgreSQLSchemaProvider) ValidateSchema(db *sql.DB) error
type RDFConverter ¶
type RDFConverter struct{}
RDFConverter handles conversion between different RDF serialization formats
func NewRDFConverter ¶
func NewRDFConverter() *RDFConverter
NewRDFConverter creates a new RDF format converter
func (*RDFConverter) Convert ¶
func (c *RDFConverter) Convert(data []byte, fromFormat, toFormat string) ([]byte, error)
Convert transforms RDF data from one format to another Supported formats: JSON-LD, Turtle, RDF/XML
func (*RDFConverter) ValidateFormat ¶
func (c *RDFConverter) ValidateFormat(format string) bool
ValidateFormat checks if the given format is supported
type ResourceCache ¶
type ResourceCache struct {
// contains filtered or unexported fields
}
ResourceCache provides in-memory caching for frequently accessed resources
func NewResourceCache ¶
func NewResourceCache(config CacheConfig) *ResourceCache
NewResourceCache creates a new resource cache with the given configuration
func (*ResourceCache) Clear ¶
func (rc *ResourceCache) Clear(ctx context.Context)
Clear clears all entries from the cache
func (*ResourceCache) GetMostAccessed ¶
func (rc *ResourceCache) GetMostAccessed(limit int) []*CacheEntry
GetMostAccessed returns the most frequently accessed resources
func (*ResourceCache) GetStats ¶
func (rc *ResourceCache) GetStats() map[string]interface{}
GetStats returns cache statistics
func (*ResourceCache) Put ¶
func (rc *ResourceCache) Put(ctx context.Context, resource *domain.Resource)
Put stores a resource in the cache
type ResourceIndex ¶
type ResourceIndex struct {
ID string `json:"id"`
ContentType string `json:"contentType"`
Size int `json:"size"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Tags map[string]string `json:"tags"`
Path string `json:"path"`
}
ResourceIndex represents an index entry for a resource
type ResourceIndexer ¶
type ResourceIndexer struct {
// contains filtered or unexported fields
}
ResourceIndexer provides fast lookup capabilities for resources
func NewResourceIndexer ¶
func NewResourceIndexer(basePath string) (*ResourceIndexer, error)
NewResourceIndexer creates a new resource indexer
func (*ResourceIndexer) AddResource ¶
func (ri *ResourceIndexer) AddResource(resource *domain.Resource) error
AddResource adds a resource to the index
func (*ResourceIndexer) FindByContentType ¶
func (ri *ResourceIndexer) FindByContentType(contentType string) []*ResourceIndex
FindByContentType finds resources by content type
func (*ResourceIndexer) FindByID ¶
func (ri *ResourceIndexer) FindByID(id string) (*ResourceIndex, bool)
FindByID finds a resource by ID
func (*ResourceIndexer) FindBySizeRange ¶
func (ri *ResourceIndexer) FindBySizeRange(minSize, maxSize int) []*ResourceIndex
FindBySizeRange finds resources within a size range
func (*ResourceIndexer) FindByTag ¶
func (ri *ResourceIndexer) FindByTag(key, value string) []*ResourceIndex
FindByTag finds resources by tag
func (*ResourceIndexer) GetStats ¶
func (ri *ResourceIndexer) GetStats() map[string]interface{}
GetStats returns indexing statistics
func (*ResourceIndexer) ListAll ¶
func (ri *ResourceIndexer) ListAll() []*ResourceIndex
ListAll returns all indexed resources
func (*ResourceIndexer) Rebuild ¶
func (ri *ResourceIndexer) Rebuild(ctx context.Context) error
Rebuild rebuilds the index by scanning the file system
func (*ResourceIndexer) RemoveResource ¶
func (ri *ResourceIndexer) RemoveResource(id string) error
RemoveResource removes a resource from the index
type ResourceMetadata ¶
type ResourceMetadata struct {
ID string `json:"id"`
ContentType string `json:"contentType"`
OriginalFormat string `json:"originalFormat"`
Size int `json:"size"`
Checksum string `json:"checksum"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Tags map[string]interface{} `json:"tags"`
}
ResourceMetadata represents the metadata stored alongside resource content
type ResourceModel ¶
type ResourceModel struct {
ID string `gorm:"primaryKey;type:varchar(255)"`
ContainerID string `gorm:"not null;type:varchar(255);index"`
Container ContainerModel `gorm:"foreignKey:ContainerID;references:ID;constraint:OnDelete:CASCADE"`
ContentType string `gorm:"not null;type:varchar(255)"`
Size int64 `gorm:"not null;default:0"`
FilePath string `gorm:"type:varchar(500)"` // Path to file on filesystem
Metadata string `gorm:"type:text"` // JSON serialized metadata
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
ResourceModel represents the GORM model for resources
func (*ResourceModel) BeforeCreate ¶
func (r *ResourceModel) BeforeCreate(tx *gorm.DB) error
BeforeCreate GORM hook for validation before creation
func (*ResourceModel) BeforeUpdate ¶
func (r *ResourceModel) BeforeUpdate(tx *gorm.DB) error
BeforeUpdate GORM hook for updating timestamps
func (ResourceModel) TableName ¶
func (ResourceModel) TableName() string
TableName specifies the table name for ResourceModel
type ResourceType ¶
type ResourceType string
ResourceType represents the type of a resource
const ( ResourceTypeContainer ResourceType = "Container" ResourceTypeResource ResourceType = "Resource" )
type SQLiteMembershipIndexer ¶
type SQLiteMembershipIndexer struct {
// contains filtered or unexported fields
}
SQLiteMembershipIndexer implements MembershipIndexer using SQLite
func MembershipIndexerProvider ¶
func MembershipIndexerProvider(basePath string) (*SQLiteMembershipIndexer, error)
MembershipIndexerProvider creates a SQLiteMembershipIndexer instance (legacy)
func NewSQLiteMembershipIndexer ¶
func NewSQLiteMembershipIndexer(dbPath string) (*SQLiteMembershipIndexer, error)
NewSQLiteMembershipIndexer creates a new SQLite membership indexer
func (*SQLiteMembershipIndexer) Close ¶
func (s *SQLiteMembershipIndexer) Close() error
Close closes the database connection
func (*SQLiteMembershipIndexer) GetContainerStats ¶
func (s *SQLiteMembershipIndexer) GetContainerStats(ctx context.Context, containerID string) (map[string]interface{}, error)
GetContainerStats returns statistics about a container
func (*SQLiteMembershipIndexer) GetContainers ¶
func (s *SQLiteMembershipIndexer) GetContainers(ctx context.Context, memberID string) ([]string, error)
GetContainers retrieves all containers that contain a specific member
func (*SQLiteMembershipIndexer) GetDB ¶
func (s *SQLiteMembershipIndexer) GetDB() *sql.DB
GetDB returns the database connection (for internal use by repository)
func (*SQLiteMembershipIndexer) GetFilteredMemberCount ¶
func (s *SQLiteMembershipIndexer) GetFilteredMemberCount(ctx context.Context, containerID string, filter FilterOptions) (int, error)
GetFilteredMemberCount returns the count of members matching the filter
func (*SQLiteMembershipIndexer) GetMemberCount ¶
func (s *SQLiteMembershipIndexer) GetMemberCount(ctx context.Context, containerID string) (int, error)
GetMemberCount returns the total number of members in a container
func (*SQLiteMembershipIndexer) GetMembers ¶
func (s *SQLiteMembershipIndexer) GetMembers(ctx context.Context, containerID string, pagination PaginationOptions) ([]MemberInfo, error)
GetMembers retrieves all members of a container with pagination
func (*SQLiteMembershipIndexer) GetMembersWithFiltering ¶
func (s *SQLiteMembershipIndexer) GetMembersWithFiltering(ctx context.Context, containerID string, pagination PaginationOptions, filter FilterOptions, sort SortOptions) ([]MemberInfo, error)
GetMembersWithFiltering retrieves container members with filtering and sorting
func (*SQLiteMembershipIndexer) IndexMembership ¶
func (s *SQLiteMembershipIndexer) IndexMembership(ctx context.Context, containerID, memberID string) error
IndexMembership adds a membership relationship to the index
func (*SQLiteMembershipIndexer) RebuildIndex ¶
func (s *SQLiteMembershipIndexer) RebuildIndex(ctx context.Context) error
RebuildIndex rebuilds the membership index from scratch
func (*SQLiteMembershipIndexer) RemoveMembership ¶
func (s *SQLiteMembershipIndexer) RemoveMembership(ctx context.Context, containerID, memberID string) error
RemoveMembership removes a membership relationship from the index
type SQLiteSchemaProvider ¶
type SQLiteSchemaProvider struct{}
SQLiteSchemaProvider implements schema operations for SQLite
func (*SQLiteSchemaProvider) CreateContainerSchema ¶
func (p *SQLiteSchemaProvider) CreateContainerSchema(db *sql.DB) error
func (*SQLiteSchemaProvider) CreateSchemaMigrationsTable ¶
func (p *SQLiteSchemaProvider) CreateSchemaMigrationsTable(db *sql.DB) error
func (*SQLiteSchemaProvider) GetCurrentSchemaVersion ¶
func (p *SQLiteSchemaProvider) GetCurrentSchemaVersion(db *sql.DB) (int, error)
func (*SQLiteSchemaProvider) RecordMigration ¶
func (*SQLiteSchemaProvider) ValidateSchema ¶
func (p *SQLiteSchemaProvider) ValidateSchema(db *sql.DB) error
type SchemaProvider ¶
type SchemaProvider interface {
CreateContainerSchema(db *sql.DB) error
CreateSchemaMigrationsTable(db *sql.DB) error
GetCurrentSchemaVersion(db *sql.DB) (int, error)
RecordMigration(db *sql.DB, version int, description string) error
ValidateSchema(db *sql.DB) error
}
SchemaProvider handles database schema operations for different database types
func NewSchemaProvider ¶
func NewSchemaProvider(driver string) (SchemaProvider, error)
NewSchemaProvider creates a schema provider for the given database driver
type SortOptions ¶
type SortOptions struct {
Field string `json:"field"` // "name", "createdAt", "updatedAt", "size", "type"
Direction string `json:"direction"` // "asc" or "desc"
}
SortOptions represents sorting options for container members
Source Files
¶
- container_cache.go
- container_rdf_converter.go
- database.go
- database_config_example.go
- database_provider.go
- event_dispatcher.go
- filesystem_container_repository.go
- filesystem_repository.go
- gorm_container_repository.go
- membership_indexer.go
- membership_indexer_generic.go
- membership_indexer_wire.go
- models.go
- optimized_filesystem_repository.go
- rdf_converter.go
- resource_cache.go
- resource_indexer.go
- schema.go
- schema_postgresql.go
- schema_provider.go
- wire.go