memory

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package memory implements the storage interface using in-memory data structures. This is designed for --no-db mode where the database is loaded from JSONL at startup and written back to JSONL after each command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStorage

type MemoryStorage struct {
	// contains filtered or unexported fields
}

MemoryStorage implements the Storage interface using in-memory data structures

func New

func New(jsonlPath string) *MemoryStorage

New creates a new in-memory storage backend

func (*MemoryStorage) AddComment

func (m *MemoryStorage) AddComment(ctx context.Context, issueID, actor, comment string) error

func (*MemoryStorage) AddDependency

func (m *MemoryStorage) AddDependency(ctx context.Context, dep *types.Dependency, actor string) error

AddDependency adds a dependency between issues

func (*MemoryStorage) AddIssueComment

func (m *MemoryStorage) AddIssueComment(ctx context.Context, issueID, author, text string) (*types.Comment, error)

func (*MemoryStorage) AddLabel

func (m *MemoryStorage) AddLabel(ctx context.Context, issueID, label, actor string) error

Add label methods

func (*MemoryStorage) ClearAllExportHashes

func (m *MemoryStorage) ClearAllExportHashes(ctx context.Context) error

ClearAllExportHashes clears all export hashes

func (*MemoryStorage) ClearDirtyIssuesByID

func (m *MemoryStorage) ClearDirtyIssuesByID(ctx context.Context, issueIDs []string) error

func (*MemoryStorage) Close

func (m *MemoryStorage) Close() error

Lifecycle

func (*MemoryStorage) CloseIssue

func (m *MemoryStorage) CloseIssue(ctx context.Context, id string, reason string, actor string, session string) error

CloseIssue closes an issue with a reason. The session parameter tracks which Claude Code session closed the issue (can be empty).

func (*MemoryStorage) CreateIssue

func (m *MemoryStorage) CreateIssue(ctx context.Context, issue *types.Issue, actor string) error

CreateIssue creates a new issue

func (*MemoryStorage) CreateIssues

func (m *MemoryStorage) CreateIssues(ctx context.Context, issues []*types.Issue, actor string) error

CreateIssues creates multiple issues atomically

func (*MemoryStorage) CreateTombstone

func (m *MemoryStorage) CreateTombstone(ctx context.Context, id string, actor string, reason string) error

CreateTombstone converts an existing issue to a tombstone record. This is a soft-delete that preserves the issue with status="tombstone".

func (*MemoryStorage) DeleteConfig

func (m *MemoryStorage) DeleteConfig(ctx context.Context, key string) error

func (*MemoryStorage) DeleteIssue

func (m *MemoryStorage) DeleteIssue(ctx context.Context, id string) error

DeleteIssue permanently deletes an issue and all associated data

func (*MemoryStorage) DetectCycles

func (m *MemoryStorage) DetectCycles(ctx context.Context) ([][]*types.Issue, error)

DetectCycles detects dependency cycles

func (*MemoryStorage) GetAllAliases added in v0.53.1

func (m *MemoryStorage) GetAllAliases(ctx context.Context) ([]types.AliasRecord, error)

func (*MemoryStorage) GetAllConfig

func (m *MemoryStorage) GetAllConfig(ctx context.Context) (map[string]string, error)

func (*MemoryStorage) GetAllDependencyRecords

func (m *MemoryStorage) GetAllDependencyRecords(ctx context.Context) (map[string][]*types.Dependency, error)

GetAllDependencyRecords gets all dependency records

func (*MemoryStorage) GetAllIssues

func (m *MemoryStorage) GetAllIssues() []*types.Issue

GetAllIssues returns all issues in memory (for export to JSONL)

func (*MemoryStorage) GetBlockedIssues

func (m *MemoryStorage) GetBlockedIssues(ctx context.Context, filter types.WorkFilter) ([]*types.BlockedIssue, error)

GetBlockedIssues returns issues that are blocked by other issues Note: Pinned issues are excluded from the output (beads-ei4)

func (*MemoryStorage) GetBranchCache added in v0.53.1

func (m *MemoryStorage) GetBranchCache(ctx context.Context, branchName string) (*types.BranchCache, error)

func (*MemoryStorage) GetBranchState added in v0.53.1

func (m *MemoryStorage) GetBranchState(ctx context.Context, scopeType types.ScopeType, scopeRef string) (*types.BranchState, error)

func (*MemoryStorage) GetCommentsForIssues

func (m *MemoryStorage) GetCommentsForIssues(ctx context.Context, issueIDs []string) (map[string][]*types.Comment, error)

func (*MemoryStorage) GetConfig

func (m *MemoryStorage) GetConfig(ctx context.Context, key string) (string, error)

func (*MemoryStorage) GetCustomStatuses

func (m *MemoryStorage) GetCustomStatuses(ctx context.Context) ([]string, error)

GetCustomStatuses retrieves the list of custom status states from config.

func (*MemoryStorage) GetCustomTypes

func (m *MemoryStorage) GetCustomTypes(ctx context.Context) ([]string, error)

GetCustomTypes retrieves the list of custom issue types from config.

func (*MemoryStorage) GetDependencies

func (m *MemoryStorage) GetDependencies(ctx context.Context, issueID string) ([]*types.Issue, error)

GetDependencies gets issues that this issue depends on

func (*MemoryStorage) GetDependenciesWithMetadata

func (m *MemoryStorage) GetDependenciesWithMetadata(ctx context.Context, issueID string) ([]*types.IssueWithDependencyMetadata, error)

GetDependenciesWithMetadata gets issues that this issue depends on, with dependency type

func (*MemoryStorage) GetDependencyCounts

func (m *MemoryStorage) GetDependencyCounts(ctx context.Context, issueIDs []string) (map[string]*types.DependencyCounts, error)

GetDependencyCounts returns dependency and dependent counts for multiple issues

func (*MemoryStorage) GetDependencyRecords

func (m *MemoryStorage) GetDependencyRecords(ctx context.Context, issueID string) ([]*types.Dependency, error)

GetDependencyRecords gets dependency records for an issue

func (*MemoryStorage) GetDependencyTree

func (m *MemoryStorage) GetDependencyTree(ctx context.Context, issueID string, maxDepth int, showAllPaths bool, reverse bool) ([]*types.TreeNode, error)

GetDependencyTree gets the dependency tree for an issue

func (*MemoryStorage) GetDependents

func (m *MemoryStorage) GetDependents(ctx context.Context, issueID string) ([]*types.Issue, error)

GetDependents gets issues that depend on this issue

func (*MemoryStorage) GetDependentsWithMetadata

func (m *MemoryStorage) GetDependentsWithMetadata(ctx context.Context, issueID string) ([]*types.IssueWithDependencyMetadata, error)

GetDependentsWithMetadata gets issues that depend on this issue, with dependency type

func (*MemoryStorage) GetDirtyIssueHash

func (m *MemoryStorage) GetDirtyIssueHash(ctx context.Context, issueID string) (string, error)

GetDirtyIssueHash returns the hash for dirty issue tracking

func (*MemoryStorage) GetDirtyIssues

func (m *MemoryStorage) GetDirtyIssues(ctx context.Context) ([]string, error)

Dirty tracking

func (*MemoryStorage) GetEpicsEligibleForClosure

func (m *MemoryStorage) GetEpicsEligibleForClosure(ctx context.Context) ([]*types.EpicStatus, error)

func (*MemoryStorage) GetEvents

func (m *MemoryStorage) GetEvents(ctx context.Context, issueID string, limit int) ([]*types.Event, error)

func (*MemoryStorage) GetExportHash

func (m *MemoryStorage) GetExportHash(ctx context.Context, issueID string) (string, error)

GetExportHash returns the hash for export tracking

func (*MemoryStorage) GetIssue

func (m *MemoryStorage) GetIssue(ctx context.Context, id string) (*types.Issue, error)

GetIssue retrieves an issue by ID

func (*MemoryStorage) GetIssueByExternalRef

func (m *MemoryStorage) GetIssueByExternalRef(ctx context.Context, externalRef string) (*types.Issue, error)

GetIssueByExternalRef retrieves an issue by external reference

func (*MemoryStorage) GetIssueComments

func (m *MemoryStorage) GetIssueComments(ctx context.Context, issueID string) ([]*types.Comment, error)

func (*MemoryStorage) GetIssuesByLabel

func (m *MemoryStorage) GetIssuesByLabel(ctx context.Context, label string) ([]*types.Issue, error)

func (*MemoryStorage) GetJSONLFileHash

func (m *MemoryStorage) GetJSONLFileHash(ctx context.Context) (string, error)

GetJSONLFileHash gets the JSONL file hash

func (*MemoryStorage) GetLabels

func (m *MemoryStorage) GetLabels(ctx context.Context, issueID string) ([]string, error)

func (*MemoryStorage) GetLabelsForIssues

func (m *MemoryStorage) GetLabelsForIssues(ctx context.Context, issueIDs []string) (map[string][]string, error)

func (*MemoryStorage) GetMetadata

func (m *MemoryStorage) GetMetadata(ctx context.Context, key string) (string, error)

func (*MemoryStorage) GetMoleculeProgress

func (m *MemoryStorage) GetMoleculeProgress(ctx context.Context, moleculeID string) (*types.MoleculeProgressStats, error)

GetMoleculeProgress returns progress stats for a molecule. For memory storage, this iterates through dependencies.

func (*MemoryStorage) GetNewlyUnblockedByClose

func (m *MemoryStorage) GetNewlyUnblockedByClose(ctx context.Context, closedIssueID string) ([]*types.Issue, error)

GetNewlyUnblockedByClose returns issues that became unblocked when the given issue was closed. This is used by the --suggest-next flag on bd close (GH#679).

func (*MemoryStorage) GetNextChildID

func (m *MemoryStorage) GetNextChildID(ctx context.Context, parentID string) (string, error)

ID Generation

func (*MemoryStorage) GetReadyWork

func (m *MemoryStorage) GetReadyWork(ctx context.Context, filter types.WorkFilter) ([]*types.Issue, error)

GetReadyWork returns issues that are ready to work on (no open blockers)

func (*MemoryStorage) GetStaleIssues

func (m *MemoryStorage) GetStaleIssues(ctx context.Context, filter types.StaleFilter) ([]*types.Issue, error)

func (*MemoryStorage) GetStatistics

func (m *MemoryStorage) GetStatistics(ctx context.Context) (*types.Statistics, error)

func (*MemoryStorage) IsBlocked

func (m *MemoryStorage) IsBlocked(ctx context.Context, issueID string) (bool, []string, error)

IsBlocked checks if an issue is blocked by open dependencies (GH#962). Returns true if the issue has open blockers, along with the list of blocker IDs.

func (*MemoryStorage) LoadFromIssues

func (m *MemoryStorage) LoadFromIssues(issues []*types.Issue) error

LoadFromIssues populates the in-memory storage from a slice of issues This is used when loading from JSONL at startup

func (*MemoryStorage) MarkIssueDirty

func (m *MemoryStorage) MarkIssueDirty(ctx context.Context, issueID string) error

MarkIssueDirty marks an issue as dirty for export

func (*MemoryStorage) Path

func (m *MemoryStorage) Path() string

func (*MemoryStorage) RemoveDependency

func (m *MemoryStorage) RemoveDependency(ctx context.Context, issueID, dependsOnID string, actor string) error

RemoveDependency removes a dependency

func (*MemoryStorage) RemoveLabel

func (m *MemoryStorage) RemoveLabel(ctx context.Context, issueID, label, actor string) error

func (*MemoryStorage) RenameCounterPrefix

func (m *MemoryStorage) RenameCounterPrefix(ctx context.Context, oldPrefix, newPrefix string) error

func (*MemoryStorage) RenameDependencyPrefix

func (m *MemoryStorage) RenameDependencyPrefix(ctx context.Context, oldPrefix, newPrefix string) error

func (*MemoryStorage) RunInTransaction

func (m *MemoryStorage) RunInTransaction(ctx context.Context, fn func(tx storage.Transaction) error) error

RunInTransaction executes a function within a transaction context. For MemoryStorage, this provides basic atomicity via mutex locking. If the function returns an error, changes are NOT automatically rolled back since MemoryStorage doesn't support true transaction rollback.

Note: For full rollback support, callers should use SQLite storage.

func (*MemoryStorage) SaveAliases added in v0.53.1

func (m *MemoryStorage) SaveAliases(ctx context.Context, aliases []types.AliasRecord) error

func (*MemoryStorage) SearchIssues

func (m *MemoryStorage) SearchIssues(ctx context.Context, query string, filter types.IssueFilter) ([]*types.Issue, error)

SearchIssues finds issues matching query and filters

func (*MemoryStorage) SetBranchState added in v0.53.1

func (m *MemoryStorage) SetBranchState(ctx context.Context, state types.BranchState) error

func (*MemoryStorage) SetConfig

func (m *MemoryStorage) SetConfig(ctx context.Context, key, value string) error

Config

func (*MemoryStorage) SetExportHash

func (m *MemoryStorage) SetExportHash(ctx context.Context, issueID, hash string) error

SetExportHash sets the hash for export tracking

func (*MemoryStorage) SetJSONLFileHash

func (m *MemoryStorage) SetJSONLFileHash(ctx context.Context, fileHash string) error

SetJSONLFileHash sets the JSONL file hash

func (*MemoryStorage) SetMetadata

func (m *MemoryStorage) SetMetadata(ctx context.Context, key, value string) error

Metadata

func (*MemoryStorage) UnderlyingConn

func (m *MemoryStorage) UnderlyingConn(ctx context.Context) (*sql.Conn, error)

UnderlyingConn returns error for memory storage (no SQL database)

func (*MemoryStorage) UnderlyingDB

func (m *MemoryStorage) UnderlyingDB() *sql.DB

UnderlyingDB returns nil for memory storage (no SQL database)

func (*MemoryStorage) UpdateBranchCache added in v0.53.1

func (m *MemoryStorage) UpdateBranchCache(ctx context.Context, cache types.BranchCache) error

func (*MemoryStorage) UpdateIssue

func (m *MemoryStorage) UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error

UpdateIssue updates fields on an issue

func (*MemoryStorage) UpdateIssueID

func (m *MemoryStorage) UpdateIssueID(ctx context.Context, oldID, newID string, issue *types.Issue, actor string) error

Prefix rename operations (no-ops for memory storage)

Jump to

Keyboard shortcuts

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