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
impl RemoteFile
sourcepub fn get_for_local_database(
database: &Database,
) -> Result<Option<Ref<RemoteFile>>, ()>
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.
sourcepub fn get_for_binary_view(
bv: &BinaryView,
) -> Result<Option<Ref<RemoteFile>>, ()>
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.
pub fn core_file(&self) -> Result<ProjectFile, ()>
pub fn project(&self) -> Result<Ref<RemoteProject>, ()>
pub fn remote(&self) -> Result<Ref<Remote>, ()>
sourcepub fn folder(&self) -> Result<Option<Ref<RemoteFolder>>, ()>
pub fn folder(&self) -> Result<Option<Ref<RemoteFolder>>, ()>
Parent folder, if one exists. None if this is in the root of the project.
sourcepub fn set_folder(&self, folder: Option<&RemoteFolder>) -> Result<(), ()>
pub fn set_folder(&self, folder: Option<&RemoteFolder>) -> Result<(), ()>
Set the parent folder of a file.
pub fn set_metadata<S: BnStrCompatible>(&self, folder: S) -> Result<(), ()>
sourcepub fn chat_log_url(&self) -> BnString
pub fn chat_log_url(&self) -> BnString
Chat log API endpoint URL
pub fn user_positions_url(&self) -> BnString
sourcepub fn file_type(&self) -> RemoteFileType
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.
sourcepub fn created(&self) -> SystemTime
pub fn created(&self) -> SystemTime
Created date of the file
pub fn created_by(&self) -> BnString
sourcepub fn last_modified(&self) -> SystemTime
pub fn last_modified(&self) -> SystemTime
Last modified of the file
sourcepub fn last_snapshot(&self) -> SystemTime
pub fn last_snapshot(&self) -> SystemTime
Date of last snapshot in the file
sourcepub fn last_snapshot_by(&self) -> BnString
pub fn last_snapshot_by(&self) -> BnString
Username of user who pushed the last snapshot in the file
pub fn last_snapshot_name(&self) -> BnString
sourcepub fn set_name<S: BnStrCompatible>(&self, name: S) -> Result<(), ()>
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.
sourcepub fn description(&self) -> BnString
pub fn description(&self) -> BnString
Desciprtion of the file
sourcepub fn set_description<S: BnStrCompatible>(
&self,
description: S,
) -> Result<(), ()>
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.
pub fn metadata(&self) -> BnString
sourcepub fn default_path(&self) -> BnString
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.
sourcepub fn has_pulled_snapshots(&self) -> bool
pub fn has_pulled_snapshots(&self) -> bool
If the file has pulled the snapshots yet
sourcepub fn snapshots(&self) -> Result<Array<RemoteSnapshot>, ()>
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.
sourcepub fn snapshot_by_id<S: BnStrCompatible>(
&self,
id: S,
) -> Result<Option<Ref<RemoteSnapshot>>, ()>
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.
sourcepub fn pull_snapshots(&self) -> Result<(), ()>
pub fn pull_snapshots(&self) -> Result<(), ()>
Pull the list of Snapshots from the Remote.
sourcepub fn pull_snapshots_with_progress<P: ProgressCallback>(
&self,
progress: P,
) -> Result<(), ()>
pub fn pull_snapshots_with_progress<P: ProgressCallback>( &self, progress: P, ) -> Result<(), ()>
Pull the list of Snapshots from the Remote.
sourcepub 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>, ()>
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 namecontents
- Snapshot contentsanalysis_cache_contents
- Contents of analysis cache of snapshotfile
- New file contents (if contents changed)parent_ids
- List of ids of parent snapshots (or empty if this is a root snapshot)
sourcepub 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>, ()>
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 namecontents
- Snapshot contentsanalysis_cache_contents
- Contents of analysis cache of snapshotfile
- 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
pub fn delete_snapshot(&self, snapshot: &RemoteSnapshot) -> Result<(), ()>
pub fn request_user_positions(&self) -> BnString
pub fn request_chat_log(&self) -> BnString
sourcepub fn download<S>(&self, db_path: S) -> Result<Ref<FileMetadata>, ()>where
S: BnStrCompatible,
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 databaseprogress_function
- Function to call for progress updates
sourcepub fn download_with_progress<S, F>(
&self,
db_path: S,
progress_function: F,
) -> Result<Ref<FileMetadata>, ()>where
S: BnStrCompatible,
F: ProgressCallback,
pub fn download_with_progress<S, F>(
&self,
db_path: S,
progress_function: F,
) -> Result<Ref<FileMetadata>, ()>where
S: BnStrCompatible,
F: ProgressCallback,
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 databaseprogress_function
- Function to call for progress updates
sourcepub fn download_database<S: BnStrCompatible>(
&self,
path: S,
) -> Result<Ref<FileMetadata>, ()>
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
.
sourcepub fn download_database_with_progress<S: BnStrCompatible>(
&self,
path: S,
progress: impl ProgressCallback,
) -> Result<Ref<FileMetadata>, ()>
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
.
sourcepub fn sync<C: DatabaseConflictHandler, N: NameChangeset>(
&self,
database: &Database,
conflict_handler: C,
name_changeset: N,
) -> Result<(), ()>
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 withconflict_handler
- Function to call to resolve snapshot conflictsname_changeset
- Function to call for naming a pushed changeset, if necessary
sourcepub fn sync_with_progress<C: DatabaseConflictHandler, P: ProgressCallback, N: NameChangeset>(
&self,
database: &Database,
conflict_handler: C,
name_changeset: N,
progress: P,
) -> Result<(), ()>
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 withconflict_handler
- Function to call to resolve snapshot conflictsname_changeset
- Function to call for naming a pushed changeset, if necessaryprogress
- Function to call for progress updates
sourcepub fn pull<C, N>(
&self,
database: &Database,
conflict_handler: C,
name_changeset: N,
) -> Result<usize, ()>where
C: DatabaseConflictHandler,
N: NameChangeset,
pub fn pull<C, N>(
&self,
database: &Database,
conflict_handler: C,
name_changeset: N,
) -> Result<usize, ()>where
C: DatabaseConflictHandler,
N: NameChangeset,
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 withconflict_handler
- Function to call to resolve snapshot conflictsname_changeset
- Function to call for naming a pushed changeset, if necessary
sourcepub fn pull_with_progress<C, P, N>(
&self,
database: &Database,
conflict_handler: C,
name_changeset: N,
progress: P,
) -> Result<usize, ()>
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 withconflict_handler
- Function to call to resolve snapshot conflictsname_changeset
- Function to call for naming a pushed changeset, if necessaryprogress
- Function to call for progress updates
sourcepub fn push<P>(&self, database: &Database) -> Result<usize, ()>where
P: ProgressCallback,
pub fn push<P>(&self, database: &Database) -> Result<usize, ()>where
P: ProgressCallback,
Push locally added snapshots to the remote.
bv_or_db
- Binary view or database to sync with
sourcepub fn push_with_progress<P>(
&self,
database: &Database,
progress: P,
) -> Result<usize, ()>where
P: ProgressCallback,
pub fn push_with_progress<P>(
&self,
database: &Database,
progress: P,
) -> Result<usize, ()>where
P: ProgressCallback,
Push locally added snapshots to the remote.
bv_or_db
- Binary view or database to sync withprogress
- Function to call for progress updates