MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / upload_database_with_progress

Function upload_database_with_progress

rust/src/collaboration/sync.rs:109–131  ·  view source on GitHub ↗

Upload a file, with database, to the remote under the given project `metadata` - Local file with database `project` - Remote project under which to place the new file `parent_folder` - Optional parent folder in which to place this file `name_changeset` - Function to call for naming a pushed changeset, if necessary `progress` - Function to call for progress updates

(
    project: &RemoteProject,
    parent_folder: Option<&RemoteFolder>,
    metadata: &FileMetadata,
    mut name_changeset: N,
    mut progress: P,
)

Source from the content-addressed store, hash-verified

107/// * `name_changeset` - Function to call for naming a pushed changeset, if necessary
108/// * `progress` - Function to call for progress updates
109pub fn upload_database_with_progress<P: ProgressCallback, N: NameChangeset>(
110 project: &RemoteProject,
111 parent_folder: Option<&RemoteFolder>,
112 metadata: &FileMetadata,
113 mut name_changeset: N,
114 mut progress: P,
115) -> Result<Ref<RemoteFile>, ()> {
116 let folder_raw = parent_folder.map_or(std::ptr::null_mut(), |h| h.handle.as_ptr());
117 let result = unsafe {
118 BNCollaborationUploadDatabase(
119 metadata.handle,
120 project.handle.as_ptr(),
121 folder_raw,
122 Some(P::cb_progress_callback),
123 &mut progress as *mut P as *mut c_void,
124 Some(N::cb_name_changeset),
125 &mut name_changeset as *mut N as *mut c_void,
126 )
127 };
128 NonNull::new(result)
129 .map(|raw| unsafe { RemoteFile::ref_from_raw(raw) })
130 .ok_or(())
131}
132
133/// Test if a database is valid for use in collaboration
134pub fn is_collaboration_database(database: &Database) -> bool {

Callers 2

upload_databaseFunction · 0.85

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected