collaboration.databasesync module

Class

Description

binaryninja.collaboration.databasesync.assign_snapshot_map

Add a snapshot to the id map in a database

binaryninja.collaboration.databasesync.default_file_path

Get the default filepath for a remote File. This is based off the Setting for collaboration.direc…

binaryninja.collaboration.databasesync.default_project_path

Get the default directory path for a remote Project. This is based off the Setting for…

binaryninja.collaboration.databasesync.download_file

Download a file from its remote, saving all snapshots to a database in the specified location.

binaryninja.collaboration.databasesync.dump_database

Print debug information about a database to stdout

binaryninja.collaboration.databasesync.get_local_snapshot_for_remote

Get the local snapshot associated with a remote snapshot (if it exists)

binaryninja.collaboration.databasesync.get_remote_file_for_local_database

Get the Remote File for a Database

binaryninja.collaboration.databasesync.get_remote_for_local_database

Get the Remote for a Database

binaryninja.collaboration.databasesync.get_remote_project_for_local_database

Get the Remote Project for a Database

binaryninja.collaboration.databasesync.get_remote_snapshot_for_local

Get the remote snapshot associated with a local snapshot (if it exists)

binaryninja.collaboration.databasesync.get_snapshot_author

Get the remote author of a local snapshot

binaryninja.collaboration.databasesync.ignore_snapshot

Ignore a snapshot from database syncing operations

binaryninja.collaboration.databasesync.is_collaboration_database

Test if a database is valid for use in collaboration

binaryninja.collaboration.databasesync.is_snapshot_ignored

Test if a snapshot is ignored from the database

binaryninja.collaboration.databasesync.merge_database

Merge all leaf snapshots in a database down to a single leaf snapshot.

binaryninja.collaboration.databasesync.pull_database

Pull updated snapshots from the remote. Merge local changes with remote changes and potentially…

binaryninja.collaboration.databasesync.push_database

Push locally added snapshots to the remote

binaryninja.collaboration.databasesync.set_snapshot_author

Set the remote author of a local snapshot (does not upload)

binaryninja.collaboration.databasesync.sync_database

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

binaryninja.collaboration.databasesync.upload_database

Upload a file, with database, to the remote under the given project

assign_snapshot_map

class assign_snapshot_map[source]

Bases:

Add a snapshot to the id map in a database

Parameters:
  • local_snapshot – Local snapshot, will use this snapshot’s database

  • remote_snapshot – Remote snapshot

Raises:

RuntimeError – If there was an error

default_file_path

class default_file_path[source]

Bases:

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.

Parameters:

file – Remote File

Returns:

Default file path

Raises:

RuntimeError – If there was an error

default_project_path

class default_project_path[source]

Bases:

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

Parameters:

project – Remote Project

Returns:

Default project path

Raises:

RuntimeError – If there was an error

download_file

class download_file[source]

Bases:

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

Parameters:
  • file – Remote File to download and open

  • db_path – File path for saved database

  • progress – Function to call for progress updates

Returns:

FileContext for opening

Raises:

RuntimeError – If there was an error

dump_database

class dump_database[source]

Bases:

Print debug information about a database to stdout

Parameters:

database – Database to dump

Raises:

RuntimeError – If there was an error

get_local_snapshot_for_remote

class get_local_snapshot_for_remote[source]

Bases:

Get the local snapshot associated with a remote snapshot (if it exists)

Parameters:
  • snapshot – Remote snapshot

  • database – Local database to search

Returns:

Snapshot reference if it exists, or None reference if not

Raises:

RuntimeError – If there was an error

get_remote_file_for_local_database

class get_remote_file_for_local_database[source]

Bases:

Get the Remote File for a Database

Parameters:

database – BN database, potentially with collaboration metadata

Returns:

Remote file from one of the connected remotes, or None if not found or if files are not pulled

Raises:

RuntimeError – If there was an error

get_remote_for_local_database

class get_remote_for_local_database[source]

Bases:

Get the Remote for a Database

Parameters:

database – BN database, potentially with collaboration metadata

Returns:

Remote from one of the connected remotes, or None if not found

Raises:

RuntimeError – If there was an error

get_remote_project_for_local_database

class get_remote_project_for_local_database[source]

Bases:

Get the Remote Project for a Database

Parameters:

database – BN database, potentially with collaboration metadata

Returns:

Remote project from one of the connected remotes, or None if not found or if projects are not pulled

Raises:

RuntimeError – If there was an error

get_remote_snapshot_for_local

class get_remote_snapshot_for_local[source]

Bases:

Get the remote snapshot associated with a local snapshot (if it exists)

Parameters:

snap – Local snapshot

Returns:

Remote snapshot if it exists, or None if not

Raises:

RuntimeError – If there was an error

get_snapshot_author

class get_snapshot_author[source]

Bases:

Get the remote author of a local snapshot

Parameters:
  • database – Parent database

  • snapshot – Snapshot to query

Returns:

Remote author, or None if one could not be determined

Raises:

RuntimeError – If there was an error

ignore_snapshot

class ignore_snapshot[source]

Bases:

Ignore a snapshot from database syncing operations

Parameters:
  • database – Parent database

  • snapshot – Snapshot to ignore

Raises:

RuntimeError – If there was an error

is_collaboration_database

class is_collaboration_database[source]

Bases:

Test if a database is valid for use in collaboration

Parameters:

database – Database to test

Returns:

True if valid

is_snapshot_ignored

class is_snapshot_ignored[source]

Bases:

Test if a snapshot is ignored from the database

Parameters:
  • database – Parent database

  • snapshot – Snapshot to test

Returns:

True if snapshot should be ignored

Raises:

RuntimeError – If there was an error

merge_database

class merge_database[source]

Bases:

Merge all leaf snapshots in a database down to a single leaf snapshot.

Parameters:
  • database – Database to merge

  • conflict_handler – Function to call for progress updates

  • progress – Function to call to resolve snapshot conflicts

Raises:

RuntimeError – If there was an error (or the operation was cancelled)

pull_database

class pull_database[source]

Bases:

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.

Parameters:
  • database – Database to pull

  • file – Remote File to pull to

  • conflict_handler – Function to call to resolve snapshot conflicts

  • progress – Function to call for progress updates

  • name_changeset – Function to call for naming a pushed changeset, if necessary

Raises:

RuntimeError – If there was an error (or the operation was cancelled)

push_database

class push_database[source]

Bases:

Push locally added snapshots to the remote

Parameters:
  • database – Database to push

  • file – Remote File to push to

  • progress – Function to call for progress updates

Raises:

RuntimeError – If there was an error (or the operation was cancelled)

set_snapshot_author

class set_snapshot_author[source]

Bases:

Set the remote author of a local snapshot (does not upload)

Parameters:
  • database – Parent database

  • snapshot – Snapshot to edit

  • author – Target author

Raises:

RuntimeError – If there was an error

sync_database

class sync_database[source]

Bases:

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

Parameters:
  • database – Database to sync

  • file – File to sync with

  • conflict_handler – Function to call to resolve snapshot conflicts

  • progress – Function to call for progress updates

  • name_changeset – Function to call for naming a pushed changeset, if necessary

Raises:

RuntimeError – If there was an error (or the operation was cancelled)

upload_database

class upload_database[source]

Bases:

Upload a file, with database, to the remote under the given project

Parameters:
  • metadata – Local file with database

  • project – Remote project under which to place the new file

  • progress – Function to call for progress updates

  • name_changeset – Function to call for naming a pushed changeset, if necessary

  • parent_folder – Optional parent folder in which to place this file

Returns:

Remote File created

Raises:

RuntimeError – If there was an error