binaryninja::collaboration

Struct RemoteFile

source
pub struct RemoteFile { /* private fields */ }
Expand description

A remote project file. It controls the various snapshots and raw file contents associated with the analysis.

Implementations§

source§

impl RemoteFile

source

pub fn get_for_local_database( database: &Database, ) -> Result<Option<Ref<RemoteFile>>, ()>

Look up the remote File for a local database, or None if there is no matching remote File found. See RemoteFile::get_for_binary_view to load from a BinaryView.

source

pub fn get_for_binary_view( bv: &BinaryView, ) -> Result<Option<Ref<RemoteFile>>, ()>

Look up the RemoteFile for a local BinaryView, or None if there is no matching remote File found.

source

pub fn core_file(&self) -> Result<ProjectFile, ()>

source

pub fn project(&self) -> Result<Ref<RemoteProject>, ()>

source

pub fn remote(&self) -> Result<Ref<Remote>, ()>

source

pub fn folder(&self) -> Result<Option<Ref<RemoteFolder>>, ()>

Parent folder, if one exists. None if this is in the root of the project.

source

pub fn set_folder(&self, folder: Option<&RemoteFolder>) -> Result<(), ()>

Set the parent folder of a file.

source

pub fn set_metadata<S: BnStrCompatible>(&self, folder: S) -> Result<(), ()>

source

pub fn url(&self) -> BnString

Web API endpoint URL

source

pub fn chat_log_url(&self) -> BnString

Chat log API endpoint URL

source

pub fn user_positions_url(&self) -> BnString

source

pub fn id(&self) -> BnString

Unique ID

source

pub fn file_type(&self) -> RemoteFileType

All files share the same properties, but files with different types may make different uses of those properties, or not use some of them at all.

source

pub fn created(&self) -> SystemTime

Created date of the file

source

pub fn created_by(&self) -> BnString

source

pub fn last_modified(&self) -> SystemTime

Last modified of the file

source

pub fn last_snapshot(&self) -> SystemTime

Date of last snapshot in the file

source

pub fn last_snapshot_by(&self) -> BnString

Username of user who pushed the last snapshot in the file

source

pub fn last_snapshot_name(&self) -> BnString

source

pub fn hash(&self) -> BnString

Hash of file contents (no algorithm guaranteed)

source

pub fn name(&self) -> BnString

Displayed name of file

source

pub fn set_name<S: BnStrCompatible>(&self, name: S) -> Result<(), ()>

Set the description of the file. You will need to push the file to update the remote version.

source

pub fn description(&self) -> BnString

Desciprtion of the file

source

pub fn set_description<S: BnStrCompatible>( &self, description: S, ) -> Result<(), ()>

Set the description of the file. You will need to push the file to update the remote version.

source

pub fn metadata(&self) -> BnString

source

pub fn size(&self) -> u64

Size of raw content of file, in bytes

source

pub fn default_path(&self) -> BnString

Get the default filepath for a remote File. This is based off the Setting for collaboration.directory, the file’s id, the file’s project’s id, and the file’s remote’s id.

source

pub fn has_pulled_snapshots(&self) -> bool

If the file has pulled the snapshots yet

source

pub fn snapshots(&self) -> Result<Array<RemoteSnapshot>, ()>

Get the list of snapshots in this file.

NOTE: If snapshots have not been pulled, they will be pulled upon calling this.

source

pub fn snapshot_by_id<S: BnStrCompatible>( &self, id: S, ) -> Result<Option<Ref<RemoteSnapshot>>, ()>

Get a specific Snapshot in the File by its id

NOTE: If snapshots have not been pulled, they will be pulled upon calling this.

source

pub fn pull_snapshots(&self) -> Result<(), ()>

Pull the list of Snapshots from the Remote.

source

pub fn pull_snapshots_with_progress<P: ProgressCallback>( &self, progress: P, ) -> Result<(), ()>

Pull the list of Snapshots from the Remote.

source

pub fn create_snapshot<S, I>( &self, name: S, contents: &mut [u8], analysis_cache_contexts: &mut [u8], file: &mut [u8], parent_ids: I, ) -> Result<Ref<RemoteSnapshot>, ()>

Create a new snapshot on the remote (and pull it)

  • name - Snapshot name
  • contents - Snapshot contents
  • analysis_cache_contents - Contents of analysis cache of snapshot
  • file - New file contents (if contents changed)
  • parent_ids - List of ids of parent snapshots (or empty if this is a root snapshot)
source

pub fn create_snapshot_with_progress<S, I, P>( &self, name: S, contents: &mut [u8], analysis_cache_contexts: &mut [u8], file: &mut [u8], parent_ids: I, progress: P, ) -> Result<Ref<RemoteSnapshot>, ()>

Create a new snapshot on the remote (and pull it)

  • name - Snapshot name
  • contents - Snapshot contents
  • analysis_cache_contents - Contents of analysis cache of snapshot
  • file - New file contents (if contents changed)
  • parent_ids - List of ids of parent snapshots (or empty if this is a root snapshot)
  • progress - Function to call on progress updates
source

pub fn delete_snapshot(&self, snapshot: &RemoteSnapshot) -> Result<(), ()>

source

pub fn request_user_positions(&self) -> BnString

source

pub fn request_chat_log(&self) -> BnString

source

pub fn download<S>(&self, db_path: S) -> Result<Ref<FileMetadata>, ()>
where S: BnStrCompatible,

Download a file from its remote, saving all snapshots to a database in the specified location. Returns a FileContext for opening the file later.

  • db_path - File path for saved database
  • progress_function - Function to call for progress updates
source

pub fn download_with_progress<S, F>( &self, db_path: S, progress_function: F, ) -> Result<Ref<FileMetadata>, ()>

Download a file from its remote, saving all snapshots to a database in the specified location. Returns a FileContext for opening the file later.

  • db_path - File path for saved database
  • progress_function - Function to call for progress updates
source

pub fn download_database<S: BnStrCompatible>( &self, path: S, ) -> Result<Ref<FileMetadata>, ()>

Download a remote file and save it to a BNDB at the given path, returning the associated FileMetadata.

source

pub fn download_database_with_progress<S: BnStrCompatible>( &self, path: S, progress: impl ProgressCallback, ) -> Result<Ref<FileMetadata>, ()>

Download a remote file and save it to a BNDB at the given path.

source

pub fn sync<C: DatabaseConflictHandler, N: NameChangeset>( &self, database: &Database, conflict_handler: C, name_changeset: N, ) -> Result<(), ()>

Completely sync a file, pushing/pulling/merging/applying changes

  • bv_or_db - Binary view or database to sync with
  • conflict_handler - Function to call to resolve snapshot conflicts
  • name_changeset - Function to call for naming a pushed changeset, if necessary
source

pub fn sync_with_progress<C: DatabaseConflictHandler, P: ProgressCallback, N: NameChangeset>( &self, database: &Database, conflict_handler: C, name_changeset: N, progress: P, ) -> Result<(), ()>

Completely sync a file, pushing/pulling/merging/applying changes

  • bv_or_db - Binary view or database to sync with
  • conflict_handler - Function to call to resolve snapshot conflicts
  • name_changeset - Function to call for naming a pushed changeset, if necessary
  • progress - Function to call for progress updates
source

pub fn pull<C, N>( &self, database: &Database, conflict_handler: C, name_changeset: N, ) -> Result<usize, ()>

Pull updated snapshots from the remote. Merge local changes with remote changes and potentially create a new snapshot for unsaved changes, named via name_changeset.

  • bv_or_db - Binary view or database to sync with
  • conflict_handler - Function to call to resolve snapshot conflicts
  • name_changeset - Function to call for naming a pushed changeset, if necessary
source

pub fn pull_with_progress<C, P, N>( &self, database: &Database, conflict_handler: C, name_changeset: N, progress: P, ) -> Result<usize, ()>

Pull updated snapshots from the remote. Merge local changes with remote changes and potentially create a new snapshot for unsaved changes, named via name_changeset.

  • bv_or_db - Binary view or database to sync with
  • conflict_handler - Function to call to resolve snapshot conflicts
  • name_changeset - Function to call for naming a pushed changeset, if necessary
  • progress - Function to call for progress updates
source

pub fn push<P>(&self, database: &Database) -> Result<usize, ()>

Push locally added snapshots to the remote.

  • bv_or_db - Binary view or database to sync with
source

pub fn push_with_progress<P>( &self, database: &Database, progress: P, ) -> Result<usize, ()>

Push locally added snapshots to the remote.

  • bv_or_db - Binary view or database to sync with
  • progress - Function to call for progress updates

Trait Implementations§

source§

impl CoreArrayProvider for RemoteFile

source§

impl Debug for RemoteFile

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for RemoteFile

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToOwned for RemoteFile

source§

type Owned = Ref<RemoteFile>

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl Eq for RemoteFile

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.