scaffold for push rpc

Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
dzdidi
2024-01-23 22:50:18 +00:00
parent 8dedb6bf17
commit a38bd12ad0
2 changed files with 57 additions and 35 deletions

View File

@@ -21,10 +21,9 @@ module.exports = class RPC {
rpc.respond('get-refs', async req => await this.getRefsHandler(req))
/* -- PUSH HANDLERS -- */
// TODO: reponders to pull requests
// normal push: git pull <url>
// force push: git reset --hard url/<branch>
// delete branch: git branch -D url/<branch>
rpc.respond('push-to-repo', async req => this.pushHandler(req))
rpc.respond('force-push-to-repo', req => this.forcePushHandler(req))
rpc.respond('delete-branch-from-repo', req => this.deleteBranchHandler(req))
this.connections[peerInfo.publicKey] = rpc
}
@@ -42,4 +41,19 @@ module.exports = class RPC {
return Buffer.from(JSON.stringify(res))
}
pushHandler (req) {
console.error('req', req.toString())
console.error('pushHandler not implemented')
}
forcePushHandler (req) {
console.error('req', req.toString())
console.error('forcePushHandler not implemented')
}
deleteBranchHandler (req) {
console.error('req', req.toString())
console.error('deleteBranchHandler not implemented')
}
}