pub struct TypeArchive { /* private fields */ }
Expand description

Type Archives are a collection of types which can be shared between different analysis sessions and are backed by a database file on disk. Their types can be modified, and a history of previous versions of types is stored in snapshots in the archive.

Implementations§

source§

impl TypeArchive

source

pub fn open<S: BnStrCompatible>(path: S) -> Option<TypeArchive>

Open the Type Archive at the given path, if it exists.

source

pub fn create<S: BnStrCompatible>( path: S, platform: &Platform ) -> Option<TypeArchive>

Create a Type Archive at the given path, returning None if it could not be created.

source

pub fn create_with_id<P: BnStrCompatible, I: BnStrCompatible>( path: P, id: I, platform: &Platform ) -> Option<TypeArchive>

Create a Type Archive at the given path and id, returning None if it could not be created.

source

pub fn lookup_by_id<S: BnStrCompatible>(id: S) -> Option<TypeArchive>

Get a reference to the Type Archive with the known id, if one exists.

source

pub fn path(&self) -> Option<BnString>

Get the path to the Type Archive’s file

source

pub fn id(&self) -> Option<BnString>

Get the guid for a Type Archive

source

pub fn platform(&self) -> Ref<Platform>

Get the associated Platform for a Type Archive

source

pub fn current_snapshot_id(&self) -> BnString

Get the id of the current snapshot in the type archive

source

pub fn set_current_snapshot_id<S: BnStrCompatible>(&self, id: S)

Revert the type archive’s current snapshot to the given snapshot

source

pub fn all_snapshot_ids(&self) -> Array<BnString>

Get a list of every snapshot’s id

source

pub fn get_snapshot_parent_ids<S: BnStrCompatible>( &self, snapshot: S ) -> Option<Array<BnString>>

Get the ids of the parents to the given snapshot

source

pub fn get_snapshot_child_ids<S: BnStrCompatible>( &self, snapshot: S ) -> Option<Array<BnString>>

Get the ids of the children to the given snapshot

source

pub fn add_type(&self, name: &QualifiedNameAndType)

Add named types to the type archive. Type must have all dependant named types added prior to being added, or this function will fail. If the type already exists, it will be overwritten.

  • name - Name of new type
  • type - Definition of new type
source

pub fn add_types(&self, new_types: &[QualifiedNameAndType])

Add named types to the type archive. Types must have all dependant named types prior to being added, or included in the list, or this function will fail. Types already existing with any added names will be overwritten.

  • new_types - Names and definitions of new types
source

pub fn rename_type( &self, old_name: &QualifiedName, new_name: &QualifiedNameAndType )

Change the name of an existing type in the type archive.

  • old_name - Old type name in archive
  • new_name - New type name
source

pub fn rename_type_by_id<S: BnStrCompatible>( &self, id: S, new_name: &QualifiedName )

Change the name of an existing type in the type archive.

  • id - Old id of type in archive
  • new_name - New type name
source

pub fn delete_type(&self, name: &QualifiedName)

Delete an existing type in the type archive.

source

pub fn delete_type_by_id<S: BnStrCompatible>(&self, id: S)

Delete an existing type in the type archive.

source

pub fn get_type_by_name<S: BnStrCompatible>( &self, name: &QualifiedName, snapshot: S ) -> Option<Ref<Type>>

Retrieve a stored type in the archive

  • name - Type name
  • snapshot - Snapshot id to search for types
source

pub fn get_type_by_id<I: BnStrCompatible, S: BnStrCompatible>( &self, id: I, snapshot: S ) -> Option<Ref<Type>>

Retrieve a stored type in the archive by id

  • id - Type id
  • snapshot - Snapshot id to search for types
source

pub fn get_type_name_by_id<I: BnStrCompatible, S: BnStrCompatible>( &self, id: I, snapshot: S ) -> QualifiedName

Retrieve a type’s name by its id

  • id - Type id
  • snapshot - Snapshot id to search for types
source

pub fn get_type_id<S: BnStrCompatible>( &self, name: &QualifiedName, snapshot: S ) -> Option<BnString>

Retrieve a type’s id by its name

  • name - Type name
  • snapshot - Snapshot id to search for types
source

pub fn get_types_and_ids<S: BnStrCompatible>( &self, snapshot: S ) -> Array<QualifiedNameTypeAndId>

Retrieve all stored types in the archive at a snapshot

  • snapshot - Snapshot id to search for types
source

pub fn get_type_ids<S: BnStrCompatible>(&self, snapshot: S) -> Array<BnString>

Get a list of all types’ ids in the archive at a snapshot

  • snapshot - Snapshot id to search for types
source

pub fn get_type_names<S: BnStrCompatible>( &self, snapshot: S ) -> Array<QualifiedName>

Get a list of all types’ names in the archive at a snapshot

  • snapshot - Snapshot id to search for types
source

pub fn get_type_names_and_ids<S: BnStrCompatible>( &self, snapshot: S ) -> (Array<QualifiedName>, Array<BnString>)

Get a list of all types’ names and ids in the archive at a current snapshot

  • snapshot - Snapshot id to search for types
source

pub fn get_outgoing_direct_references<I: BnStrCompatible, S: BnStrCompatible>( &self, id: I, snapshot: S ) -> Array<BnString>

Get all types a given type references directly

  • id - Source type id
  • snapshot - Snapshot id to search for types
source

pub fn get_outgoing_recursive_references<I: BnStrCompatible, S: BnStrCompatible>( &self, id: I, snapshot: S ) -> Array<BnString>

Get all types a given type references, and any types that the referenced types reference

:param id: Source type id :param snapshot: Snapshot id to search for types

source

pub fn get_incoming_direct_references<I: BnStrCompatible, S: BnStrCompatible>( &self, id: I, snapshot: S ) -> Array<BnString>

Get all types that reference a given type

  • id - Target type id
  • snapshot - Snapshot id to search for types
source

pub fn get_incoming_recursive_references<I: BnStrCompatible, S: BnStrCompatible>( &self, id: I, snapshot: S ) -> Array<BnString>

Get all types that reference a given type, and all types that reference them, recursively

  • id - Target type id
  • snapshot - Snapshot id to search for types, or empty string to search the latest snapshot
source

pub fn query_metadata<S: BnStrCompatible>( &self, key: S ) -> Option<Ref<Metadata>>

Look up a metadata entry in the archive

source

pub fn store_metadata<S: BnStrCompatible>(&self, key: S, md: &Metadata)

Store a key/value pair in the archive’s metadata storage

  • key - key value to associate the Metadata object with
  • md - object to store.
source

pub fn remove_metadata<S: BnStrCompatible>(&self, key: S) -> bool

Delete a given metadata entry in the archive from the key

source

pub fn serialize_snapshot<S: BnStrCompatible>(&self, snapshot: S) -> DataBuffer

Turn a given snapshot id into a data stream

source

pub fn deserialize_snapshot(&self, data: &DataBuffer) -> BnString

Take a serialized snapshot data stream and create a new snapshot from it

source

pub fn register_notification_callback<T: TypeArchiveNotificationCallback>( &self, callback: T ) -> TypeArchiveCallbackHandle<T>

Register a notification listener

source

pub fn register_notification_closure<A, U, R, D>( &self, type_added: A, type_updated: U, type_renamed: R, type_deleted: D ) -> TypeArchiveCallbackHandle<NotificationClosure<A, U, R, D>>

source

pub fn close(self)

Close a type archive, disconnecting it from any active views and closing any open file handles

source

pub fn is_type_archive<P: BnStrCompatible>(file: P) -> bool

Determine if file is a Type Archive

source

pub fn new_snapshot_transaction<P, F>( &self, function: F, parents: &[BnString] ) -> BnString
where P: BnStrCompatible, F: FnMut(&str) -> bool,

Do some function in a transaction making a new snapshot whose id is passed to func. If func throws, the transaction will be rolled back and the snapshot will not be created.

  • func - Function to call
  • parents - Parent snapshot ids

Returns Created snapshot id

source

pub fn merge_snapshots<B, F, S, P, M, MI, MK>( &self, base_snapshot: B, first_snapshot: F, second_snapshot: S, merge_conflicts: M, progress: P ) -> Result<BnString, Array<BnString>>

Merge two snapshots in the archive to produce a new snapshot

  • base_snapshot - Common ancestor of snapshots
  • first_snapshot - First snapshot to merge
  • second_snapshot - Second snapshot to merge
  • merge_conflicts - List of all conflicting types, id <-> target snapshot
  • progress - Function to call for progress updates

Returns Snapshot id, if merge was successful, otherwise the List of conflicting type ids

Trait Implementations§

source§

impl Clone for TypeArchive

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CoreArrayProvider for TypeArchive

§

type Raw = *mut BNTypeArchive

§

type Context = ()

§

type Wrapped<'a> = &'a TypeArchive

source§

impl Debug for TypeArchive

source§

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

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

impl Drop for TypeArchive

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Hash for TypeArchive

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for TypeArchive

source§

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

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

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

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

impl Eq for TypeArchive

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

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

§

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>,

§

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.