X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/e0ab6220b6fd35f7e92a04e4bf149940185713ab..a4cfb030bf949e2fc9cd0ddace9e33f24b791b18:/memory.go?ds=sidebyside diff --git a/memory.go b/memory.go index a3665a1..6937726 100644 --- a/memory.go +++ b/memory.go @@ -56,7 +56,7 @@ type Memory struct { tree *Tree chat *View cview *View - queue *queue + queue *BuildQueue summarizer Summarizer ctx context.Context cancel context.CancelFunc @@ -66,8 +66,8 @@ type Memory struct { // viewFile is the content of view.json. type viewFile struct { - Chat viewState `json:"chat"` - Compaction viewState `json:"compaction"` + Chat ViewState `json:"chat"` + Compaction ViewState `json:"compaction"` } // openMemory opens the chat in root and starts the builds that are ready. The @@ -82,7 +82,7 @@ func openMemory(ctx context.Context, root string, clock func() time.Time, summar m := &Memory{ root: root, log: log, - queue: newQueue(), + queue: newBuildQueue(), summarizer: summarizer, changed: make(chan struct{}), } @@ -126,8 +126,8 @@ func openMemory(ctx context.Context, root string, clock func() time.Time, summar func (m *Memory) load() error { data, err := os.ReadFile(m.viewPath()) if errors.Is(err, os.ErrNotExist) && m.log.Len() == 0 { - m.chat = newView(chatHigh, chatLow) - m.cview = newView(compactionHigh, compactionLow) + m.chat = newView(viewChatHigh, viewChatLow) + m.cview = newView(viewCompactionHigh, viewCompactionLow) return nil } @@ -146,12 +146,12 @@ func (m *Memory) load() error { return fmt.Errorf("decode view: %w", err) } - m.chat, err = restoreView(file.Chat, chatHigh, chatLow, m.tree) + m.chat, err = restoreView(file.Chat, viewChatHigh, viewChatLow, m.tree) if err != nil { return fmt.Errorf("chat view: %w", err) } - m.cview, err = restoreView(file.Compaction, compactionHigh, compactionLow, m.tree) + m.cview, err = restoreView(file.Compaction, viewCompactionHigh, viewCompactionLow, m.tree) if err != nil { return fmt.Errorf("compaction view: %w", err) }