MCPcopy Index your code
hub / github.com/coder/mux / setPinned

Method setPinned

src/node/services/memoryMeta.ts:181–198  ·  view source on GitHub ↗
(logicalKey: string, pinned: boolean)

Source from the content-addressed store, hash-verified

179 }
180
181 async setPinned(logicalKey: string, pinned: boolean): Promise<void> {
182 await this.mutate((entries) => {
183 const current = entries[logicalKey] ?? EMPTY_ENTRY;
184 if (pinned) {
185 // Pinning counts as a use: it is an explicit signal the file matters,
186 // and it feeds the same recency/frequency ranking as reads/writes.
187 entries[logicalKey] = {
188 ...current,
189 pinned: true,
190 accessCount: current.accessCount + 1,
191 lastAccessedAt: Date.now(),
192 };
193 } else {
194 // Unpinning preserves usage stats; mutate() drops the entry if empty.
195 entries[logicalKey] = { ...current, pinned: false };
196 }
197 });
198 }
199
200 /** Record a use (read or write) of a memory file at the MemoryService chokepoint. */
201 async recordAccess(logicalKey: string, options: { write: boolean }): Promise<void> {

Callers 6

handleTogglePinFunction · 0.80
memoryMeta.test.tsFile · 0.80
routerFunction · 0.80

Calls 1

mutateMethod · 0.95

Tested by

no test coverage detected