-
Notifications
You must be signed in to change notification settings - Fork 5.7k
feat(ext/node): (partial) impl sqlite 'backup' function #29842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
ext/node/ops/sqlite/backup.rs
Outdated
pub async fn op_backup_db( | ||
state: Rc<RefCell<OpState>>, | ||
) -> Result<i64, SqliteError> { | ||
Ok(69) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
Hi @littledivy I'm trying to impl. the node:sqlite Deno uses function provided by fn backup_db<P: AsRef<Path>>(
src: &rusqlite::Connection,
dst: P,
progress: fn(rusqlite::backup::Progress),
) -> Result<()> { ... } Node's backup function signature async function backup(
sourceDb: DatabaseSync,
path: string,
options?: BackupOptions,
): Promise<void>; At this point i know that the |
ff3a6eb
to
829c972
Compare
let src_conn_ref = source_db.conn.borrow(); | ||
let src_conn = src_conn_ref.as_ref().ok_or(SqliteError::SessionClosed)?; | ||
let path = std::path::Path::new(&path); | ||
let mut dst_conn = Connection::open(path)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll need to add write permission checks here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
judging by the signature
function backup(
sourceDb: DatabaseSync,
path: string | Buffer | URL,
options?: BackupOptions,
): Promise<void>;
Since path
can have different forms, we'll need to check diff permissions accordingly.
I can't figure how to pass the progress call back function from |
829c972
to
84457b5
Compare
84457b5
to
16da5ef
Compare
Towards #29439
This PR aims to implement the
node:sqlite backup
function