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(&self, folder: &str) -> Result<(), ()>
Sourcepub fn chat_log_url(&self) -> String
pub fn chat_log_url(&self) -> String
Chat log API endpoint URL
pub fn user_positions_url(&self) -> String
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) -> String
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) -> String
pub fn last_snapshot_by(&self) -> String
Username of user who pushed the last snapshot in the file
pub fn last_snapshot_name(&self) -> String
Sourcepub fn set_name(&self, name: &str) -> Result<(), ()>
pub fn set_name(&self, name: &str) -> Result<(), ()>
Set the description of the file. You will need to push the file to update the remote version.
Sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Desciprtion of the file
Sourcepub fn set_description(&self, description: &str) -> Result<(), ()>
pub fn set_description(&self, description: &str) -> Result<(), ()>
Set the description of the file. You will need to push the file to update the remote version.
pub fn metadata(&self) -> String
Sourcepub fn default_path(&self) -> String
pub fn default_path(&self) -> String
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(
&self,
id: &str,
) -> Result<Option<Ref<RemoteSnapshot>>, ()>
pub fn snapshot_by_id( &self, id: &str, ) -> 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<I>(
&self,
name: &str,
contents: &mut [u8],
analysis_cache_contexts: &mut [u8],
file: &mut [u8],
parent_ids: I,
) -> Result<Ref<RemoteSnapshot>, ()>where
I: IntoIterator<Item = String>,
pub fn create_snapshot<I>(
&self,
name: &str,
contents: &mut [u8],
analysis_cache_contexts: &mut [u8],
file: &mut [u8],
parent_ids: I,
) -> Result<Ref<RemoteSnapshot>, ()>where
I: IntoIterator<Item = String>,
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<I, P>(
&self,
name: &str,
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<I, P>( &self, name: &str, 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) -> String
pub fn request_chat_log(&self) -> String
Sourcepub fn download(&self) -> Result<(), ()>
pub fn download(&self) -> Result<(), ()>
Download a remote file and possibly dependencies to its project Dependency download behavior depends on the value of the collaboration.autoDownloadFileDependencies setting
progress- Function to call on progress updates
Sourcepub fn download_with_progress<P>(&self, progress: P) -> Result<(), ()>where
P: ProgressCallback,
pub fn download_with_progress<P>(&self, progress: P) -> Result<(), ()>where
P: ProgressCallback,
Download a remote file and possibly dependencies to its project Dependency download behavior depends on the value of the collaboration.autoDownloadFileDependencies setting
progress- Function to call on progress updates
Sourcepub fn download_database(
&self,
path: impl AsRef<Path>,
) -> Result<Ref<FileMetadata>, ()>
pub fn download_database( &self, path: impl AsRef<Path>, ) -> Result<Ref<FileMetadata>, ()>
Download a remote file and save it to a BNDB at the given path, returning the associated 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.
path- File path for saved database
Sourcepub fn download_database_with_progress(
&self,
path: impl AsRef<Path>,
progress: impl ProgressCallback,
) -> Result<Ref<FileMetadata>, ()>
pub fn download_database_with_progress( &self, path: impl AsRef<Path>, progress: impl ProgressCallback, ) -> Result<Ref<FileMetadata>, ()>
Download a remote file and save it to a BNDB at the given path, returning the associated 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.
path- File path for saved databaseprogress_function- Function to call for progress updates
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
Trait Implementations§
Source§impl CoreArrayProvider for RemoteFile
impl CoreArrayProvider for RemoteFile
Source§impl Debug for RemoteFile
impl Debug for RemoteFile
Source§impl PartialEq for RemoteFile
impl PartialEq for RemoteFile
Source§impl ToOwned for RemoteFile
impl ToOwned for RemoteFile
Source§type Owned = Ref<RemoteFile>
type Owned = Ref<RemoteFile>
Source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
impl Eq for RemoteFile
Auto Trait Implementations§
impl Freeze for RemoteFile
impl RefUnwindSafe for RemoteFile
impl !Send for RemoteFile
impl !Sync for RemoteFile
impl Unpin for RemoteFile
impl UnwindSafe for RemoteFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more