Documentation
¶
Overview ¶
Package repository provides functionality for interacting with bundle repositories
Package repository provides interfaces and implementations for accessing templates and modules
Index ¶
- Variables
- func AddRepository(repo Repository) error
- func ConnectAll(ctx context.Context) error
- func DisconnectAll() error
- func FindFiles(ctx context.Context, pattern string) (map[Repository][]FileInfo, error)
- func FindFilesWithCache(ctx context.Context, pattern string) (map[Repository][]FileInfo, error)
- func GetFile(ctx context.Context, path string) (io.ReadCloser, error)
- func GetFileFromRepo(ctx context.Context, repoName, path string) (io.ReadCloser, error)
- func GetFileFromRepoWithCache(ctx context.Context, repoName, path string) (io.ReadCloser, error)
- func GetFileWithCache(ctx context.Context, path string) (io.ReadCloser, error)
- func RemoveRepository(name string) error
- type BaseRepository
- func (r *BaseRepository) AcquireConnection(ctx context.Context) error
- func (r *BaseRepository) CreateContextWithTimeout(ctx context.Context) (context.Context, context.CancelFunc)
- func (r *BaseRepository) GetLastError() (error, time.Time)
- func (r *BaseRepository) GetName() string
- func (r *BaseRepository) GetType() RepositoryType
- func (r *BaseRepository) GetURL() string
- func (r *BaseRepository) IsConnected() bool
- func (r *BaseRepository) ReleaseConnection()
- func (r *BaseRepository) WithRetry(ctx context.Context, operation func() error) error
- type CacheManager
- func (c *CacheManager) Clear()
- func (c *CacheManager) ClearFileCache()
- func (c *CacheManager) ClearQueryCache()
- func (c *CacheManager) FindFile(ctx context.Context, path string) (Repository, error)
- func (c *CacheManager) FindFiles(ctx context.Context, pattern string) (map[Repository][]FileInfo, error)
- func (c *CacheManager) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
- func (c *CacheManager) GetFileFromRepo(ctx context.Context, repoName, path string) (io.ReadCloser, error)
- func (c *CacheManager) GetStats() map[string]interface{}
- func (c *CacheManager) Prune() int
- func (c *CacheManager) SetCompressionEnabled(enabled bool)
- func (c *CacheManager) SetCompressionLevel(level int)
- func (c *CacheManager) SetDefaultTTL(ttl time.Duration)
- func (c *CacheManager) SetMaxSize(maxSize int)
- func (c *CacheManager) SetPruneInterval(interval time.Duration)
- type CacheManagerOptions
- type CacheStats
- type Config
- type DatabaseConfig
- type DatabaseRepository
- func (r *DatabaseRepository) Connect(ctx context.Context) error
- func (r *DatabaseRepository) DeleteFile(ctx context.Context, path string) error
- func (r *DatabaseRepository) Disconnect() error
- func (r *DatabaseRepository) FileExists(ctx context.Context, path string) (bool, error)
- func (r *DatabaseRepository) GetBranch() string
- func (r *DatabaseRepository) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
- func (r *DatabaseRepository) GetLastModified(ctx context.Context, path string) (time.Time, error)
- func (r *DatabaseRepository) ListFiles(ctx context.Context, pattern string) ([]FileInfo, error)
- func (r *DatabaseRepository) StoreFile(ctx context.Context, path string, name string, content []byte, ...) error
- type DatabaseType
- type Factory
- type FileInfo
- type GitHubRepository
- func (r *GitHubRepository) Connect(ctx context.Context) error
- func (r *GitHubRepository) Disconnect() error
- func (r *GitHubRepository) FileExists(ctx context.Context, path string) (bool, error)
- func (r *GitHubRepository) GetBranch() string
- func (r *GitHubRepository) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
- func (r *GitHubRepository) GetLastModified(ctx context.Context, path string) (time.Time, error)
- func (r *GitHubRepository) ListFiles(ctx context.Context, pattern string) ([]FileInfo, error)
- type GitLabRepository
- func (r *GitLabRepository) Connect(ctx context.Context) error
- func (r *GitLabRepository) Disconnect() error
- func (r *GitLabRepository) FileExists(ctx context.Context, path string) (bool, error)
- func (r *GitLabRepository) GetBranch() string
- func (r *GitLabRepository) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
- func (r *GitLabRepository) GetLastModified(ctx context.Context, path string) (time.Time, error)
- func (r *GitLabRepository) ListFiles(ctx context.Context, pattern string) ([]FileInfo, error)
- type HTTPRepository
- func (r *HTTPRepository) Connect(ctx context.Context) error
- func (r *HTTPRepository) Disconnect() error
- func (r *HTTPRepository) FileExists(ctx context.Context, filePath string) (bool, error)
- func (r *HTTPRepository) GetBranch() string
- func (r *HTTPRepository) GetFile(ctx context.Context, filePath string) (io.ReadCloser, error)
- func (r *HTTPRepository) GetLastModified(ctx context.Context, filePath string) (time.Time, error)
- func (r *HTTPRepository) ListFiles(ctx context.Context, pattern string) ([]FileInfo, error)
- type LocalFSRepository
- func (r *LocalFSRepository) Connect(ctx context.Context) error
- func (r *LocalFSRepository) Disconnect() error
- func (r *LocalFSRepository) FileExists(ctx context.Context, path string) (bool, error)
- func (r *LocalFSRepository) GetBranch() string
- func (r *LocalFSRepository) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
- func (r *LocalFSRepository) GetLastModified(ctx context.Context, path string) (time.Time, error)
- func (r *LocalFSRepository) ListFiles(ctx context.Context, pattern string) ([]FileInfo, error)
- type Manager
- func (m *Manager) AddRepository(repo Repository) error
- func (m *Manager) ConnectAll(ctx context.Context) error
- func (m *Manager) CreateRepository(config *Config) (Repository, error)
- func (m *Manager) DisconnectAll() error
- func (m *Manager) FindFile(ctx context.Context, path string) (Repository, error)
- func (m *Manager) FindFiles(ctx context.Context, pattern string) (map[Repository][]FileInfo, error)
- func (m *Manager) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
- func (m *Manager) GetFileFromRepo(ctx context.Context, repoName, path string) (io.ReadCloser, error)
- func (m *Manager) GetRepository(name string) (Repository, error)
- func (m *Manager) ListRepositories() []Repository
- func (m *Manager) RemoveRepository(name string) error
- type OfflineBundleRepository
- func (r *OfflineBundleRepository) Connect(ctx context.Context) error
- func (r *OfflineBundleRepository) Disconnect(ctx context.Context) error
- func (r *OfflineBundleRepository) GetFile(ctx context.Context, path string) ([]byte, error)
- func (r *OfflineBundleRepository) GetFileInfo(ctx context.Context, path string) (FileInfo, error)
- func (r *OfflineBundleRepository) GetOfflineBundle() *bundle.OfflineBundle
- func (r *OfflineBundleRepository) GetRepositoryInfo(ctx context.Context) (RepositoryInfo, error)
- func (r *OfflineBundleRepository) GetValidationLevel() bundle.ValidationLevel
- func (r *OfflineBundleRepository) IsConnected() bool
- func (r *OfflineBundleRepository) ListFiles(ctx context.Context, path string) ([]FileInfo, error)
- func (r *OfflineBundleRepository) SetValidationLevel(level bundle.ValidationLevel)
- type Repository
- func Create(config *Config) (Repository, error)
- func CreateRepository(config *Config) (Repository, error)
- func FindFile(ctx context.Context, path string) (Repository, error)
- func FindFileWithCache(ctx context.Context, path string) (Repository, error)
- func GetRepository(name string) (Repository, error)
- func ListRepositories() []Repository
- func NewDatabaseRepository(config *Config) (Repository, error)
- func NewGitHubRepository(config *Config) (Repository, error)
- func NewGitLabRepository(config *Config) (Repository, error)
- func NewHTTPRepository(config *Config) (Repository, error)
- func NewLocalFSRepository(config *Config) (Repository, error)
- func NewS3Repository(config *Config) (Repository, error)
- type RepositoryAuditLogger
- func (l *RepositoryAuditLogger) GenerateComplianceReport(ctx context.Context, repositoryID string, startTime, endTime time.Time) (string, error)
- func (l *RepositoryAuditLogger) LogFileDownloadFailure(ctx context.Context, repositoryID, filePath string, err error)
- func (l *RepositoryAuditLogger) LogFileDownloadStart(ctx context.Context, repositoryID, filePath string)
- func (l *RepositoryAuditLogger) LogFileDownloadSuccess(ctx context.Context, repositoryID, filePath string, sizeBytes int64)
- func (l *RepositoryAuditLogger) LogFileExists(ctx context.Context, repositoryID, filePath string, exists bool)
- func (l *RepositoryAuditLogger) LogFileExistsFailure(ctx context.Context, repositoryID, filePath string, err error)
- func (l *RepositoryAuditLogger) LogFileList(ctx context.Context, repositoryID, pattern string, count int)
- func (l *RepositoryAuditLogger) LogFileListFailure(ctx context.Context, repositoryID, pattern string, err error)
- func (l *RepositoryAuditLogger) LogGetLastModified(ctx context.Context, repositoryID, filePath string, modTime time.Time)
- func (l *RepositoryAuditLogger) LogGetLastModifiedFailure(ctx context.Context, repositoryID, filePath string, err error)
- func (l *RepositoryAuditLogger) LogRepositoryConnect(ctx context.Context, repositoryID string)
- func (l *RepositoryAuditLogger) LogRepositoryConnectFailure(ctx context.Context, repositoryID string, err error)
- func (l *RepositoryAuditLogger) LogRepositoryConnectSuccess(ctx context.Context, repositoryID string)
- func (l *RepositoryAuditLogger) LogRepositoryDeleteFile(ctx context.Context, repoURL, path string)
- func (l *RepositoryAuditLogger) LogRepositoryDisconnect(ctx context.Context, repositoryID string)
- func (l *RepositoryAuditLogger) LogRepositoryFileExists(ctx context.Context, repoURL, path string)
- func (l *RepositoryAuditLogger) LogRepositoryGetFile(ctx context.Context, repoURL, path string)
- func (l *RepositoryAuditLogger) LogRepositoryGetLastModified(ctx context.Context, repoURL, path string)
- func (l *RepositoryAuditLogger) LogRepositoryListFiles(ctx context.Context, repoURL, pattern string)
- func (l *RepositoryAuditLogger) LogRepositoryStoreFile(ctx context.Context, repoURL, path string)
- type RepositoryCreator
- type RepositoryInfo
- type RepositoryType
- type S3Repository
- func (r *S3Repository) Connect(ctx context.Context) error
- func (r *S3Repository) DeleteFile(ctx context.Context, path string) error
- func (r *S3Repository) Disconnect() error
- func (r *S3Repository) FileExists(ctx context.Context, path string) (bool, error)
- func (r *S3Repository) GetBranch() string
- func (r *S3Repository) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
- func (r *S3Repository) GetLastModified(ctx context.Context, path string) (time.Time, error)
- func (r *S3Repository) ListFiles(ctx context.Context, pattern string) ([]FileInfo, error)
- func (r *S3Repository) StoreFile(ctx context.Context, path string, content []byte) error
Constants ¶
This section is empty.
Variables ¶
var DefaultCacheManager = NewCacheManager(DefaultManager, DefaultCacheManagerOptions())
DefaultCacheManager is the default cache manager
var DefaultFactory = NewFactory()
DefaultFactory is the default repository factory with standard repository types registered
var DefaultManager = NewManager()
DefaultManager is the default repository manager
Functions ¶
func AddRepository ¶
func AddRepository(repo Repository) error
AddRepository adds a repository to the default manager
func ConnectAll ¶
ConnectAll connects to all repositories in the default manager
func DisconnectAll ¶
func DisconnectAll() error
DisconnectAll disconnects from all repositories in the default manager
func FindFiles ¶
FindFiles finds files matching a pattern in all repositories in the default manager
func FindFilesWithCache ¶
FindFiles finds files matching a pattern in all repositories with caching using the default cache manager
func GetFileFromRepo ¶
GetFileFromRepo gets a file from a specific repository in the default manager
func GetFileFromRepoWithCache ¶
GetFileFromRepo gets a file from a specific repository with caching using the default cache manager
func GetFileWithCache ¶
GetFile gets a file from any repository that has it with caching using the default cache manager
func RemoveRepository ¶
RemoveRepository removes a repository from the default manager
Types ¶
type BaseRepository ¶
type BaseRepository struct {
// contains filtered or unexported fields
}
BaseRepository provides common functionality for all repository implementations
func NewBaseRepository ¶
func NewBaseRepository(config *Config) *BaseRepository
NewBaseRepository creates a new base repository
func (*BaseRepository) AcquireConnection ¶
func (r *BaseRepository) AcquireConnection(ctx context.Context) error
AcquireConnection acquires a connection from the pool
func (*BaseRepository) CreateContextWithTimeout ¶
func (r *BaseRepository) CreateContextWithTimeout(ctx context.Context) (context.Context, context.CancelFunc)
CreateContextWithTimeout creates a context with the repository's timeout
func (*BaseRepository) GetLastError ¶
func (r *BaseRepository) GetLastError() (error, time.Time)
GetLastError returns the last error and its time
func (*BaseRepository) GetName ¶
func (r *BaseRepository) GetName() string
GetName returns the repository name
func (*BaseRepository) GetType ¶
func (r *BaseRepository) GetType() RepositoryType
GetType returns the repository type
func (*BaseRepository) GetURL ¶
func (r *BaseRepository) GetURL() string
GetURL returns the repository URL
func (*BaseRepository) IsConnected ¶
func (r *BaseRepository) IsConnected() bool
IsConnected returns true if the repository is connected
func (*BaseRepository) ReleaseConnection ¶
func (r *BaseRepository) ReleaseConnection()
ReleaseConnection releases a connection back to the pool
type CacheManager ¶
type CacheManager struct {
// contains filtered or unexported fields
}
CacheManager manages caching for repository operations
func NewCacheManager ¶
func NewCacheManager(manager *Manager, options *CacheManagerOptions) *CacheManager
NewCacheManager creates a new cache manager
func (*CacheManager) ClearFileCache ¶
func (c *CacheManager) ClearFileCache()
ClearFileCache clears the file cache
func (*CacheManager) ClearQueryCache ¶
func (c *CacheManager) ClearQueryCache()
ClearQueryCache clears the query cache
func (*CacheManager) FindFile ¶
func (c *CacheManager) FindFile(ctx context.Context, path string) (Repository, error)
FindFile finds a file in all repositories with caching
func (*CacheManager) FindFiles ¶
func (c *CacheManager) FindFiles(ctx context.Context, pattern string) (map[Repository][]FileInfo, error)
FindFiles finds files matching a pattern in all repositories with caching
func (*CacheManager) GetFile ¶
func (c *CacheManager) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
GetFile gets a file from any repository that has it with caching
func (*CacheManager) GetFileFromRepo ¶
func (c *CacheManager) GetFileFromRepo(ctx context.Context, repoName, path string) (io.ReadCloser, error)
GetFileFromRepo gets a file from a specific repository with caching
func (*CacheManager) GetStats ¶
func (c *CacheManager) GetStats() map[string]interface{}
GetStats returns statistics about the cache
func (*CacheManager) Prune ¶
func (c *CacheManager) Prune() int
Prune removes old entries from all caches
func (*CacheManager) SetCompressionEnabled ¶
func (c *CacheManager) SetCompressionEnabled(enabled bool)
SetCompressionEnabled sets whether compression is enabled
func (*CacheManager) SetCompressionLevel ¶
func (c *CacheManager) SetCompressionLevel(level int)
SetCompressionLevel sets the compression level (1-9)
func (*CacheManager) SetDefaultTTL ¶
func (c *CacheManager) SetDefaultTTL(ttl time.Duration)
SetDefaultTTL sets the default TTL for cache entries
func (*CacheManager) SetMaxSize ¶
func (c *CacheManager) SetMaxSize(maxSize int)
SetMaxSize sets the maximum size of the caches
func (*CacheManager) SetPruneInterval ¶
func (c *CacheManager) SetPruneInterval(interval time.Duration)
SetPruneInterval sets the interval at which to prune the cache
type CacheManagerOptions ¶
type CacheManagerOptions struct {
// EnableCache enables caching
EnableCache bool
// DefaultTTL is the default time-to-live for cache entries
DefaultTTL time.Duration
// MaxSize is the maximum size of the cache
MaxSize int
// EnableCompression enables compression of cached data
EnableCompression bool
// CompressionLevel is the compression level (1-9)
CompressionLevel int
// PruneInterval is the interval at which to prune the cache
PruneInterval time.Duration
}
CacheManagerOptions represents options for the cache manager
func DefaultCacheManagerOptions ¶
func DefaultCacheManagerOptions() *CacheManagerOptions
DefaultCacheManagerOptions returns default cache manager options
type CacheStats ¶
type CacheStats struct {
// QueryHits is the number of query cache hits
QueryHits int64
// QueryMisses is the number of query cache misses
QueryMisses int64
// FileHits is the number of file cache hits
FileHits int64
// FileMisses is the number of file cache misses
FileMisses int64
// TotalHits is the total number of cache hits
TotalHits int64
// TotalMisses is the total number of cache misses
TotalMisses int64
// TotalLookups is the total number of lookups
TotalLookups int64
// HitRatio is the overall hit ratio
HitRatio float64
}
CacheStats tracks statistics for the cache manager
type Config ¶
type Config struct {
// Type is the repository type
Type RepositoryType
// Name is the repository name
Name string
// URL is the repository URL
URL string
// Branch is the repository branch (for Git repositories)
Branch string
// Username is the username for authentication
Username string
// Password is the password or token for authentication
Password string
// Timeout is the timeout for repository operations
Timeout time.Duration
// AuditLogger is the audit logger for repository operations
AuditLogger *audit.AuditLogger
// ProxyURL is the URL of the proxy server
ProxyURL string
// InsecureSkipVerify disables TLS certificate verification
InsecureSkipVerify bool
// MaxConnections is the maximum number of connections to the repository
MaxConnections int
// RetryCount is the number of times to retry a failed operation
RetryCount int
// RetryDelay is the delay between retries
RetryDelay time.Duration
}
Config represents the configuration for a repository
func NewConfig ¶
func NewConfig(repoType RepositoryType, name, url string) *Config
NewConfig creates a new repository configuration with default values
type DatabaseConfig ¶
type DatabaseConfig struct {
// Type is the database type
Type DatabaseType
// TableName is the name of the table storing templates
TableName string
// ConnectionString is the database connection string
ConnectionString string
}
DatabaseConfig extends the repository Config with database-specific options
type DatabaseRepository ¶
type DatabaseRepository struct {
*BaseRepository
// contains filtered or unexported fields
}
DatabaseRepository implements the Repository interface for database repositories
func (*DatabaseRepository) Connect ¶
func (r *DatabaseRepository) Connect(ctx context.Context) error
Connect establishes a connection to the database repository
func (*DatabaseRepository) DeleteFile ¶
func (r *DatabaseRepository) DeleteFile(ctx context.Context, path string) error
DeleteFile deletes a file from the database repository
func (*DatabaseRepository) Disconnect ¶
func (r *DatabaseRepository) Disconnect() error
Disconnect closes the connection to the database repository
func (*DatabaseRepository) FileExists ¶
FileExists checks if a file exists in the database repository
func (*DatabaseRepository) GetBranch ¶
func (r *DatabaseRepository) GetBranch() string
GetBranch returns the branch of the repository Database repositories don't have branches, so this returns an empty string
func (*DatabaseRepository) GetFile ¶
func (r *DatabaseRepository) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
GetFile retrieves a file from the database repository
func (*DatabaseRepository) GetLastModified ¶
GetLastModified gets the last modified time of a file in the database repository
type DatabaseType ¶
type DatabaseType string
DatabaseType represents the type of database
const ( // MySQL database type MySQL DatabaseType = "mysql" // PostgreSQL database type PostgreSQL DatabaseType = "postgres" // SQLite database type SQLite DatabaseType = "sqlite" )
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory creates repository instances based on configuration
func (*Factory) Create ¶
func (f *Factory) Create(config *Config) (Repository, error)
Create creates a repository instance based on the configuration
func (*Factory) Register ¶
func (f *Factory) Register(repoType RepositoryType, creator RepositoryCreator)
Register registers a repository creator for a specific type
type FileInfo ¶
type FileInfo struct {
// Path is the path to the file within the repository
Path string
// Name is the name of the file
Name string
// Size is the size of the file in bytes
Size int64
// LastModified is the time the file was last modified
LastModified time.Time
// IsDirectory indicates if the file is a directory
IsDirectory bool
}
FileInfo represents information about a file in a repository
type GitHubRepository ¶
type GitHubRepository struct {
*BaseRepository
// contains filtered or unexported fields
}
GitHubRepository implements the Repository interface for GitHub repositories
func (*GitHubRepository) Connect ¶
func (r *GitHubRepository) Connect(ctx context.Context) error
Connect establishes a connection to the GitHub repository
func (*GitHubRepository) Disconnect ¶
func (r *GitHubRepository) Disconnect() error
Disconnect closes the connection to the GitHub repository
func (*GitHubRepository) FileExists ¶
FileExists checks if a file exists in the GitHub repository
func (*GitHubRepository) GetBranch ¶
func (r *GitHubRepository) GetBranch() string
GetBranch returns the branch of the repository
func (*GitHubRepository) GetFile ¶
func (r *GitHubRepository) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
GetFile retrieves a file from the GitHub repository
func (*GitHubRepository) GetLastModified ¶
GetLastModified gets the last modified time of a file in the GitHub repository
type GitLabRepository ¶
type GitLabRepository struct {
*BaseRepository
// contains filtered or unexported fields
}
GitLabRepository implements the Repository interface for GitLab repositories
func (*GitLabRepository) Connect ¶
func (r *GitLabRepository) Connect(ctx context.Context) error
Connect establishes a connection to the GitLab repository
func (*GitLabRepository) Disconnect ¶
func (r *GitLabRepository) Disconnect() error
Disconnect closes the connection to the GitLab repository
func (*GitLabRepository) FileExists ¶
FileExists checks if a file exists in the GitLab repository
func (*GitLabRepository) GetBranch ¶
func (r *GitLabRepository) GetBranch() string
GetBranch returns the branch of the repository
func (*GitLabRepository) GetFile ¶
func (r *GitLabRepository) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
GetFile retrieves a file from the GitLab repository
func (*GitLabRepository) GetLastModified ¶
GetLastModified gets the last modified time of a file in the GitLab repository
type HTTPRepository ¶
type HTTPRepository struct {
*BaseRepository
// contains filtered or unexported fields
}
HTTPRepository implements the Repository interface for HTTP/HTTPS repositories
func (*HTTPRepository) Connect ¶
func (r *HTTPRepository) Connect(ctx context.Context) error
Connect establishes a connection to the HTTP repository
func (*HTTPRepository) Disconnect ¶
func (r *HTTPRepository) Disconnect() error
Disconnect closes the connection to the HTTP repository
func (*HTTPRepository) FileExists ¶
FileExists checks if a file exists in the HTTP repository
func (*HTTPRepository) GetBranch ¶
func (r *HTTPRepository) GetBranch() string
GetBranch returns the branch of the repository HTTP repositories don't have branches, so this returns an empty string
func (*HTTPRepository) GetFile ¶
func (r *HTTPRepository) GetFile(ctx context.Context, filePath string) (io.ReadCloser, error)
GetFile retrieves a file from the HTTP repository
func (*HTTPRepository) GetLastModified ¶
GetLastModified gets the last modified time of a file in the HTTP repository
type LocalFSRepository ¶
type LocalFSRepository struct {
*BaseRepository
// contains filtered or unexported fields
}
LocalFSRepository implements the Repository interface for local file system repositories
func (*LocalFSRepository) Connect ¶
func (r *LocalFSRepository) Connect(ctx context.Context) error
Connect establishes a connection to the local file system repository
func (*LocalFSRepository) Disconnect ¶
func (r *LocalFSRepository) Disconnect() error
Disconnect closes the connection to the local file system repository
func (*LocalFSRepository) FileExists ¶
FileExists checks if a file exists in the local file system repository
func (*LocalFSRepository) GetBranch ¶
func (r *LocalFSRepository) GetBranch() string
GetBranch returns the branch of the repository Local file system repositories don't have branches, so this returns an empty string
func (*LocalFSRepository) GetFile ¶
func (r *LocalFSRepository) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
GetFile retrieves a file from the local file system repository
func (*LocalFSRepository) GetLastModified ¶
GetLastModified gets the last modified time of a file in the local file system repository
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages multiple repositories
func (*Manager) AddRepository ¶
func (m *Manager) AddRepository(repo Repository) error
AddRepository adds a repository to the manager
func (*Manager) ConnectAll ¶
ConnectAll connects to all repositories
func (*Manager) CreateRepository ¶
func (m *Manager) CreateRepository(config *Config) (Repository, error)
CreateRepository creates a new repository from a configuration
func (*Manager) DisconnectAll ¶
DisconnectAll disconnects from all repositories
func (*Manager) GetFileFromRepo ¶
func (m *Manager) GetFileFromRepo(ctx context.Context, repoName, path string) (io.ReadCloser, error)
GetFileFromRepo gets a file from a specific repository
func (*Manager) GetRepository ¶
func (m *Manager) GetRepository(name string) (Repository, error)
GetRepository gets a repository by name
func (*Manager) ListRepositories ¶
func (m *Manager) ListRepositories() []Repository
ListRepositories lists all repositories
func (*Manager) RemoveRepository ¶
RemoveRepository removes a repository from the manager
type OfflineBundleRepository ¶
type OfflineBundleRepository struct {
// contains filtered or unexported fields
}
OfflineBundleRepository implements the Repository interface for offline bundles
func NewOfflineBundleRepository ¶
func NewOfflineBundleRepository(basePath string, auditTrail *trail.AuditTrailManager) *OfflineBundleRepository
NewOfflineBundleRepository creates a new offline bundle repository
func (*OfflineBundleRepository) Connect ¶
func (r *OfflineBundleRepository) Connect(ctx context.Context) error
Connect connects to the repository
func (*OfflineBundleRepository) Disconnect ¶
func (r *OfflineBundleRepository) Disconnect(ctx context.Context) error
Disconnect disconnects from the repository
func (*OfflineBundleRepository) GetFileInfo ¶
GetFileInfo gets information about a file in the repository
func (*OfflineBundleRepository) GetOfflineBundle ¶
func (r *OfflineBundleRepository) GetOfflineBundle() *bundle.OfflineBundle
GetOfflineBundle gets the loaded offline bundle
func (*OfflineBundleRepository) GetRepositoryInfo ¶
func (r *OfflineBundleRepository) GetRepositoryInfo(ctx context.Context) (RepositoryInfo, error)
GetRepositoryInfo gets information about the repository
func (*OfflineBundleRepository) GetValidationLevel ¶
func (r *OfflineBundleRepository) GetValidationLevel() bundle.ValidationLevel
GetValidationLevel gets the current validation level
func (*OfflineBundleRepository) IsConnected ¶
func (r *OfflineBundleRepository) IsConnected() bool
IsConnected checks if the repository is connected
func (*OfflineBundleRepository) SetValidationLevel ¶
func (r *OfflineBundleRepository) SetValidationLevel(level bundle.ValidationLevel)
SetValidationLevel sets the validation level for offline bundles
type Repository ¶
type Repository interface {
// Connect establishes a connection to the repository
Connect(ctx context.Context) error
// Disconnect closes the connection to the repository
Disconnect() error
// IsConnected returns true if the repository is connected
IsConnected() bool
// GetName returns the name of the repository
GetName() string
// GetBranch returns the branch of the repository
GetBranch() string
// GetType returns the type of the repository
GetType() RepositoryType
// GetURL returns the repository URL
GetURL() string
// ListFiles lists files in the repository matching the pattern
ListFiles(ctx context.Context, pattern string) ([]FileInfo, error)
// GetFile retrieves a file from the repository
GetFile(ctx context.Context, filePath string) (io.ReadCloser, error)
// FileExists checks if a file exists in the repository
FileExists(ctx context.Context, filePath string) (bool, error)
// GetLastModified gets the last modified time of a file in the repository
GetLastModified(ctx context.Context, filePath string) (time.Time, error)
}
Repository defines the interface for interacting with a template/module repository
func Create ¶
func Create(config *Config) (Repository, error)
Create creates a repository instance using the default factory
func CreateRepository ¶
func CreateRepository(config *Config) (Repository, error)
CreateRepository creates a new repository from a configuration and adds it to the default manager
func FindFile ¶
func FindFile(ctx context.Context, path string) (Repository, error)
FindFile finds a file in all repositories in the default manager
func FindFileWithCache ¶
func FindFileWithCache(ctx context.Context, path string) (Repository, error)
FindFile finds a file in all repositories with caching using the default cache manager
func GetRepository ¶
func GetRepository(name string) (Repository, error)
GetRepository gets a repository by name from the default manager
func ListRepositories ¶
func ListRepositories() []Repository
ListRepositories lists all repositories in the default manager
func NewDatabaseRepository ¶
func NewDatabaseRepository(config *Config) (Repository, error)
NewDatabaseRepository creates a new database repository
func NewGitHubRepository ¶
func NewGitHubRepository(config *Config) (Repository, error)
NewGitHubRepository creates a new GitHub repository
func NewGitLabRepository ¶
func NewGitLabRepository(config *Config) (Repository, error)
NewGitLabRepository creates a new GitLab repository
func NewHTTPRepository ¶
func NewHTTPRepository(config *Config) (Repository, error)
NewHTTPRepository creates a new HTTP repository
func NewLocalFSRepository ¶
func NewLocalFSRepository(config *Config) (Repository, error)
NewLocalFSRepository creates a new local file system repository
func NewS3Repository ¶
func NewS3Repository(config *Config) (Repository, error)
NewS3Repository creates a new S3 repository
type RepositoryAuditLogger ¶
type RepositoryAuditLogger struct {
// AuditLogger is the underlying audit logger
AuditLogger *audit.AuditLogger
// RepositoryType is the type of repository (HTTP, File, etc.)
RepositoryType string
// RepositoryURL is the URL of the repository
RepositoryURL string
}
RepositoryAuditLogger is a wrapper around the audit.AuditLogger that provides repository-specific audit logging functionality
func NewRepositoryAuditLogger ¶
func NewRepositoryAuditLogger(auditLogger *audit.AuditLogger, repositoryType, repositoryURL string) *RepositoryAuditLogger
NewRepositoryAuditLogger creates a new repository audit logger
func (*RepositoryAuditLogger) GenerateComplianceReport ¶
func (l *RepositoryAuditLogger) GenerateComplianceReport(ctx context.Context, repositoryID string, startTime, endTime time.Time) (string, error)
GenerateComplianceReport generates a compliance report for repository operations
func (*RepositoryAuditLogger) LogFileDownloadFailure ¶
func (l *RepositoryAuditLogger) LogFileDownloadFailure(ctx context.Context, repositoryID, filePath string, err error)
LogFileDownloadFailure logs a failed file download
func (*RepositoryAuditLogger) LogFileDownloadStart ¶
func (l *RepositoryAuditLogger) LogFileDownloadStart(ctx context.Context, repositoryID, filePath string)
LogFileDownloadStart logs the start of a file download
func (*RepositoryAuditLogger) LogFileDownloadSuccess ¶
func (l *RepositoryAuditLogger) LogFileDownloadSuccess(ctx context.Context, repositoryID, filePath string, sizeBytes int64)
LogFileDownloadSuccess logs a successful file download
func (*RepositoryAuditLogger) LogFileExists ¶
func (l *RepositoryAuditLogger) LogFileExists(ctx context.Context, repositoryID, filePath string, exists bool)
LogFileExists logs a file existence check
func (*RepositoryAuditLogger) LogFileExistsFailure ¶
func (l *RepositoryAuditLogger) LogFileExistsFailure(ctx context.Context, repositoryID, filePath string, err error)
LogFileExistsFailure logs a failed file existence check
func (*RepositoryAuditLogger) LogFileList ¶
func (l *RepositoryAuditLogger) LogFileList(ctx context.Context, repositoryID, pattern string, count int)
LogFileList logs a file listing event
func (*RepositoryAuditLogger) LogFileListFailure ¶
func (l *RepositoryAuditLogger) LogFileListFailure(ctx context.Context, repositoryID, pattern string, err error)
LogFileListFailure logs a failed file listing event
func (*RepositoryAuditLogger) LogGetLastModified ¶
func (l *RepositoryAuditLogger) LogGetLastModified(ctx context.Context, repositoryID, filePath string, modTime time.Time)
LogGetLastModified logs a last modified time check
func (*RepositoryAuditLogger) LogGetLastModifiedFailure ¶
func (l *RepositoryAuditLogger) LogGetLastModifiedFailure(ctx context.Context, repositoryID, filePath string, err error)
LogGetLastModifiedFailure logs a failed last modified time check
func (*RepositoryAuditLogger) LogRepositoryConnect ¶
func (l *RepositoryAuditLogger) LogRepositoryConnect(ctx context.Context, repositoryID string)
LogRepositoryConnect logs a repository connection event
func (*RepositoryAuditLogger) LogRepositoryConnectFailure ¶
func (l *RepositoryAuditLogger) LogRepositoryConnectFailure(ctx context.Context, repositoryID string, err error)
LogRepositoryConnectFailure logs a failed repository connection event
func (*RepositoryAuditLogger) LogRepositoryConnectSuccess ¶
func (l *RepositoryAuditLogger) LogRepositoryConnectSuccess(ctx context.Context, repositoryID string)
LogRepositoryConnectSuccess logs a successful repository connection event
func (*RepositoryAuditLogger) LogRepositoryDeleteFile ¶
func (l *RepositoryAuditLogger) LogRepositoryDeleteFile(ctx context.Context, repoURL, path string)
LogRepositoryDeleteFile logs a file deletion operation
func (*RepositoryAuditLogger) LogRepositoryDisconnect ¶
func (l *RepositoryAuditLogger) LogRepositoryDisconnect(ctx context.Context, repositoryID string)
LogRepositoryDisconnect logs a repository disconnection event
func (*RepositoryAuditLogger) LogRepositoryFileExists ¶
func (l *RepositoryAuditLogger) LogRepositoryFileExists(ctx context.Context, repoURL, path string)
LogRepositoryFileExists logs a file existence check operation
func (*RepositoryAuditLogger) LogRepositoryGetFile ¶
func (l *RepositoryAuditLogger) LogRepositoryGetFile(ctx context.Context, repoURL, path string)
LogRepositoryGetFile logs a file retrieval operation
func (*RepositoryAuditLogger) LogRepositoryGetLastModified ¶
func (l *RepositoryAuditLogger) LogRepositoryGetLastModified(ctx context.Context, repoURL, path string)
LogRepositoryGetLastModified logs a last modified time retrieval operation
func (*RepositoryAuditLogger) LogRepositoryListFiles ¶
func (l *RepositoryAuditLogger) LogRepositoryListFiles(ctx context.Context, repoURL, pattern string)
LogRepositoryListFiles logs a file listing operation in a repository
func (*RepositoryAuditLogger) LogRepositoryStoreFile ¶
func (l *RepositoryAuditLogger) LogRepositoryStoreFile(ctx context.Context, repoURL, path string)
LogRepositoryStoreFile logs a file storage operation
type RepositoryCreator ¶
type RepositoryCreator func(config *Config) (Repository, error)
RepositoryCreator is a function that creates a repository instance
type RepositoryInfo ¶
type RepositoryInfo struct {
// Type is the repository type
Type RepositoryType
// Name is the repository name
Name string
// URL is the repository URL
URL string
// Branch is the repository branch
Branch string
// LocalPath is the local path where the repository is stored
LocalPath string
// CurrentVersion is the current version (commit hash or tag)
CurrentVersion string
// LatestVersion is the latest available version
LatestVersion string
// Description is a description of the repository
Description string
// LastSynced is the time the repository was last synced
LastSynced time.Time
}
RepositoryInfo represents information about a repository
type RepositoryType ¶
type RepositoryType string
RepositoryType represents the type of repository
const ( // GitHub repository type GitHub RepositoryType = "github" // GitLab repository type GitLab RepositoryType = "gitlab" // LocalFS repository type (local file system) LocalFS RepositoryType = "local" // HTTP repository type (generic HTTP/HTTPS) HTTP RepositoryType = "http" // Database repository type Database RepositoryType = "database" // S3 repository type S3 RepositoryType = "s3" )
type S3Repository ¶
type S3Repository struct {
*BaseRepository
// contains filtered or unexported fields
}
S3Repository implements the Repository interface for AWS S3 repositories
func (*S3Repository) Connect ¶
func (r *S3Repository) Connect(ctx context.Context) error
Connect establishes a connection to the S3 repository
func (*S3Repository) DeleteFile ¶
func (r *S3Repository) DeleteFile(ctx context.Context, path string) error
DeleteFile deletes a file from the S3 repository
func (*S3Repository) Disconnect ¶
func (r *S3Repository) Disconnect() error
Disconnect closes the connection to the S3 repository
func (*S3Repository) FileExists ¶
FileExists checks if a file exists in the S3 repository
func (*S3Repository) GetBranch ¶
func (r *S3Repository) GetBranch() string
GetBranch returns the branch of the repository S3 repositories don't have branches, so this returns an empty string
func (*S3Repository) GetFile ¶
func (r *S3Repository) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
GetFile retrieves a file from the S3 repository
func (*S3Repository) GetLastModified ¶
GetLastModified gets the last modified time of a file in the S3 repository
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package interfaces defines interfaces for repository operations
|
Package interfaces defines interfaces for repository operations |