Documentation
¶
Overview ¶
Package codebase provides codebase management functionality.
Index ¶
- type FileInfo
- type FileStore
- func (s *FileStore) Create(ctx context.Context, codebase *types.Codebase) error
- func (s *FileStore) Delete(ctx context.Context, id string) error
- func (s *FileStore) Exists(ctx context.Context, id string) (bool, error)
- func (s *FileStore) Get(ctx context.Context, id string) (*types.Codebase, error)
- func (s *FileStore) List(ctx context.Context, ownerID string, limit, offset int) ([]*types.Codebase, error)
- func (s *FileStore) Update(ctx context.Context, codebase *types.Codebase) error
- type Manager
- func (m *Manager) CreateCodebase(ctx context.Context, req *types.CreateCodebaseRequest) (*types.Codebase, error)
- func (m *Manager) DeleteCodebase(ctx context.Context, id string) error
- func (m *Manager) DeleteFile(ctx context.Context, codebaseID, filePath string) error
- func (m *Manager) GetCodebase(ctx context.Context, id string) (*types.Codebase, error)
- func (m *Manager) GetCodebasePath(ctx context.Context, id string) (string, error)
- func (m *Manager) ListCodebases(ctx context.Context, ownerID string, limit, offset int) ([]*types.Codebase, error)
- func (m *Manager) ListFiles(ctx context.Context, codebaseID, path string, recursive bool) ([]FileInfo, error)
- func (m *Manager) ReadFile(ctx context.Context, codebaseID, filePath string) (io.ReadCloser, error)
- func (m *Manager) RefreshStats(ctx context.Context, codebaseID string) error
- func (m *Manager) WriteFile(ctx context.Context, codebaseID, filePath string, content io.Reader) error
- type MemoryStore
- func (s *MemoryStore) Create(ctx context.Context, codebase *types.Codebase) error
- func (s *MemoryStore) Delete(ctx context.Context, id string) error
- func (s *MemoryStore) Exists(ctx context.Context, id string) (bool, error)
- func (s *MemoryStore) Get(ctx context.Context, id string) (*types.Codebase, error)
- func (s *MemoryStore) List(ctx context.Context, ownerID string, limit, offset int) ([]*types.Codebase, error)
- func (s *MemoryStore) Update(ctx context.Context, codebase *types.Codebase) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileInfo ¶
type FileInfo struct {
Path string `json:"path"`
Name string `json:"name"`
IsDir bool `json:"is_dir"`
Size int64 `json:"size"`
ModifiedAt time.Time `json:"modified_at"`
}
FileInfo represents information about a file or directory.
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore implements Store interface using file-based JSON storage. Each codebase metadata is stored as a JSON file.
func NewFileStore ¶
NewFileStore creates a new file-based store.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles codebase operations including file management.
func NewManager ¶
NewManager creates a new codebase manager.
func NewManagerWithStore ¶
NewManagerWithStore creates a manager with a custom store (useful for testing).
func (*Manager) CreateCodebase ¶
func (m *Manager) CreateCodebase(ctx context.Context, req *types.CreateCodebaseRequest) (*types.Codebase, error)
CreateCodebase creates a new codebase.
func (*Manager) DeleteCodebase ¶
DeleteCodebase deletes a codebase and all its files.
func (*Manager) DeleteFile ¶
DeleteFile removes a file from the codebase.
func (*Manager) GetCodebase ¶
GetCodebase retrieves a codebase by ID.
func (*Manager) GetCodebasePath ¶
GetCodebasePath returns the file system path for a codebase.
func (*Manager) ListCodebases ¶
func (m *Manager) ListCodebases(ctx context.Context, ownerID string, limit, offset int) ([]*types.Codebase, error)
ListCodebases lists codebases for an owner.
func (*Manager) ListFiles ¶
func (m *Manager) ListFiles(ctx context.Context, codebaseID, path string, recursive bool) ([]FileInfo, error)
ListFiles lists files in a codebase directory.
func (*Manager) RefreshStats ¶
RefreshStats recalculates stats for a codebase (public API).
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore implements Store interface using in-memory storage. Useful for testing and development.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore creates a new in-memory store.
func (*MemoryStore) Delete ¶
func (s *MemoryStore) Delete(ctx context.Context, id string) error
Delete removes a codebase metadata by ID.
type Store ¶
type Store interface {
// Create stores a new codebase metadata.
Create(ctx context.Context, codebase *types.Codebase) error
// Get retrieves a codebase by ID.
Get(ctx context.Context, id string) (*types.Codebase, error)
// List retrieves all codebases for an owner.
// If ownerID is empty, returns all codebases.
List(ctx context.Context, ownerID string, limit, offset int) ([]*types.Codebase, error)
// Update updates an existing codebase metadata.
Update(ctx context.Context, codebase *types.Codebase) error
// Delete removes a codebase metadata by ID.
Delete(ctx context.Context, id string) error
// Exists checks if a codebase with the given ID exists.
Exists(ctx context.Context, id string) (bool, error)
}
Store defines the interface for codebase metadata storage.