forked from permaweb/ao
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d50662c
commit bf3f1ee
Showing
7 changed files
with
63 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const setSchedulerOwnerQuery = (processId, owner) => ({ | ||
sql: ` | ||
INSERT INTO scheduler_owner(process_id, owner) VALUES(?, ?) | ||
ON CONFLICT (process_id) DO NOTHING; | ||
`, | ||
parameters: [processId, owner] | ||
}) | ||
|
||
export function setSchedulerOwner (db, processId, owner) { | ||
const result = db.run(setSchedulerOwnerQuery(processId, owner)) | ||
console.log(result) | ||
} | ||
|
||
const getSchedulerOwnerQuery = (processId) => ({ | ||
sql: ` | ||
SELECT owner | ||
FROM scheduler_owner | ||
WHERE process_id = ?; | ||
`, | ||
parameters: [processId] | ||
}) | ||
|
||
export function getSchedulerOwner (db, processId) { | ||
const result = db.get(getSchedulerOwnerQuery(processId)) | ||
console.log(result) | ||
return result?.owner | ||
} |