MCPcopy Create free account
hub / github.com/arctic-cli/interface / write

Function write

packages/arctic/src/util/lock.ts:73–97  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

71 }
72
73 export async function write(key: string): Promise<Disposable> {
74 const lock = get(key)
75
76 return new Promise((resolve) => {
77 if (!lock.writer && lock.readers === 0) {
78 lock.writer = true
79 resolve({
80 [Symbol.dispose]: () => {
81 lock.writer = false
82 process(key)
83 },
84 })
85 } else {
86 lock.waitingWriters.push(() => {
87 lock.writer = true
88 resolve({
89 [Symbol.dispose]: () => {
90 lock.writer = false
91 process(key)
92 },
93 })
94 })
95 }
96 })
97 }
98}

Callers

nothing calls this directly

Calls 4

resolveFunction · 0.85
pushMethod · 0.80
getFunction · 0.70
processFunction · 0.70

Tested by

no test coverage detected