Documentation
¶
Index ¶
- type YAMLRepository
- func (r *YAMLRepository) Create(ctx context.Context, i *interaction.Interaction) error
- func (r *YAMLRepository) DeleteByTaskID(ctx context.Context, taskID string) (int, error)
- func (r *YAMLRepository) ExpirePendingByTask(ctx context.Context, taskID string) (int, error)
- func (r *YAMLRepository) Get(ctx context.Context, id string) (*interaction.Interaction, error)
- func (r *YAMLRepository) GetByResponseToken(ctx context.Context, token string) (*interaction.Interaction, error)
- func (r *YAMLRepository) List(ctx context.Context, taskID string, taskIDs []string, ...) ([]*interaction.Interaction, int, error)
- func (r *YAMLRepository) NotifyTaskArchived(ctx context.Context, projectID, taskID string) error
- func (r *YAMLRepository) NotifyTaskUnarchived(ctx context.Context, projectID, taskID string) error
- func (r *YAMLRepository) Update(ctx context.Context, i *interaction.Interaction) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type YAMLRepository ¶
type YAMLRepository struct {
// contains filtered or unexported fields
}
YAMLRepository implements interaction.Repository using YAML files on Storage.
Instead of scanning the entire filesystem at startup, interactions are loaded lazily per task on first access. Decoded *Interaction values are cached in dataCache so List / Get serve from memory after the initial load. Active tasks are enumerated via the injected task.Repository (which maintains its own in-memory cache); archived tasks are only touched when explicitly requested, so routine operations never pay for archived I/O.
func NewYAMLRepository ¶
func NewYAMLRepository(s storage.Storage, taskRepo task.Repository) *YAMLRepository
NewYAMLRepository constructs a YAMLRepository backed by the given storage and the provided task repository. The task repository is used to enumerate active / archived tasks on demand; it is required for correct per-task lazy loading.
func (*YAMLRepository) Create ¶
func (r *YAMLRepository) Create(ctx context.Context, i *interaction.Interaction) error
func (*YAMLRepository) DeleteByTaskID ¶
func (*YAMLRepository) ExpirePendingByTask ¶
func (*YAMLRepository) Get ¶
func (r *YAMLRepository) Get(ctx context.Context, id string) (*interaction.Interaction, error)
func (*YAMLRepository) GetByResponseToken ¶
func (r *YAMLRepository) GetByResponseToken(ctx context.Context, token string) (*interaction.Interaction, error)
func (*YAMLRepository) List ¶
func (r *YAMLRepository) List(ctx context.Context, taskID string, taskIDs []string, statusFilter interaction.InteractionStatus, limit, offset int) ([]*interaction.Interaction, int, error)
List returns interactions matching the provided filters. See interaction.Repository for semantics. statusFilter = StatusUnspecified means "no filter".
func (*YAMLRepository) NotifyTaskArchived ¶ added in v0.0.46
func (r *YAMLRepository) NotifyTaskArchived(ctx context.Context, projectID, taskID string) error
NotifyTaskArchived flips the cached location for the given task's interactions so subsequent writes use the archived path.
func (*YAMLRepository) NotifyTaskUnarchived ¶ added in v0.0.46
func (r *YAMLRepository) NotifyTaskUnarchived(ctx context.Context, projectID, taskID string) error
NotifyTaskUnarchived flips the cached location for the given task's interactions back to the active path.
func (*YAMLRepository) Update ¶
func (r *YAMLRepository) Update(ctx context.Context, i *interaction.Interaction) error