- Notifications
You must be signed in to change notification settings - Fork5.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 ourterms of service andprivacy 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
I'm trying to impl. the node:sqlite Deno uses function provided by fnbackup_db<P:AsRef<Path>>(src:&rusqlite::Connection,dst:P,progress:fn(rusqlite::backup::Progress),) ->Result<()>{ ...} Node's backup function signature asyncfunctionbackup(sourceDb:DatabaseSync,path:string,options?:BackupOptions,):Promise<void>; At this point i know that the |
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
functionbackup(sourceDb:DatabaseSync,path:string|Buffer|URL,options?:BackupOptions,):Promise<void>;
Sincepath
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 |
Towards#29439
This PR aims to implement the
node:sqlite backup
function