CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
OdTfStorage Struct Reference

#include <TfRevisionControl.h>

Inheritance diagram for OdTfStorage:
OdRxObject CloudGfxCache OdTfRepository

Public Member Functions

 OdTfStorage ()
 
 ~OdTfStorage ()
 
OdTfDigest store (OdDbDatabase *pDb, const OdDbObjectIdArray *objectsToSave=0)
 
OdDbDatabasePtr retrieve (const OdTfDigest &sha, bool partial=false) const
 
bool isSchemePresent (const OdTfDigest &sha) const
 
OdStreamBufPtr makeSchemePatch (const OdTfDigest &sha) const
 
OdTfDigest applySchemePatch (OdStreamBufPtr &schemePatch) const
 
void dryMerge (const OdTfDigest &mine, const OdTfDigest &theirs, const OdTfDigest &base, OdTfMergeHandler &mergeHandler) const
 
void dryMerge (const OdDbDatabase *pDb, const OdTfDigest &theirs, const OdTfDigest &base, OdTfMergeHandler &mergeHandler) const
 
OdDbDatabasePtr merge (const OdTfDigest &mine, const OdTfDigest &theirs, const OdTfDigest &base, OdTfMergeHandler &mergeHandler) const
 
void merge (OdDbDatabase *pDb, const OdTfDigest &theirs, const OdTfDigest &base, OdTfMergeHandler &mergeHandler) const
 
OdStreamBufPtr makePatch (const OdTfDigestArray &from, const OdTfDigestArray &to, const OdTfRevisionControl::ReferenceList &refs=OdTfRevisionControl::ReferenceList()) const
 
void applyPatch (OdStreamBuf *s, OdTfDigestArray &roots, OdTfRevisionControl::ReferenceList &refs)
 
void getRevisionDifference (const OdTfDigest &newRevision, const OdTfDigest &oldRevision, OdTfRevisionControl::ChangeList &result) const
 
void getRevisionDifference (OdDbDatabase *pDb, const OdTfDigest &revision, OdTfRevisionControl::ChangeList &result) const
 
OdStreamBufPtr getStorageStream () const
 
void setReference (const OdString &refName, const OdTfDigest &sha)
 
void setReference (const OdTfRevisionControl::ReferenceList &branches)
 
bool getReference (const OdString &refName, OdTfDigest &sha) const
 
void getReferences (OdTfRevisionControl::ReferenceList &refs) const
 
- Public Member Functions inherited from OdRxObject
 ODRX_HEAP_OPERATORS ()
 
 OdRxObject ()
 
virtual ~OdRxObject ()
 
virtual OdRxObjectqueryX (const OdRxClass *pClass) const
 
virtual OdRxObjectx (const OdRxClass *pClass) const
 
virtual OdRxClassisA () const
 
virtual void addRef ()=0
 
virtual void release ()=0
 
virtual long numRefs () const
 
bool isKindOf (const OdRxClass *pClass) const
 
virtual OdRxObjectPtr clone () const
 
virtual void copyFrom (const OdRxObject *pSource)
 
virtual OdRx::Ordering comparedTo (const OdRxObject *pOther) const
 
virtual bool isEqualTo (const OdRxObject *pOther) const
 

Protected Member Functions

void makePatch (OdStreamBuf *s, const OdTfDigestArray &from, const OdTfDigestArray &to, const OdTfRevisionControl::ReferenceList &refs) const
 

Protected Attributes

OdTfStorageImplm_pImpl
 

Friends

struct OdTfStorageImpl
 
void OdTfRevisionControl::beginPartialImport (OdStreamBufPtr pStream, OdDbDatabase *pDb)
 

Additional Inherited Members

- Static Public Member Functions inherited from OdRxObject
static OdRxObjectPtr cast (const OdRxObject *pointer)
 
static OdRxClassdesc ()
 

Detailed Description

This structure represents the low level storage of drawing revisions.

Definition at line 604 of file TfRevisionControl.h.

Constructor & Destructor Documentation

◆ OdTfStorage()

OdTfStorage::OdTfStorage ( )

Creates a new instance of the OdTfStorage object with default parameters.

◆ ~OdTfStorage()

OdTfStorage::~OdTfStorage ( )

Destroys the OdTfStorage object.

Member Function Documentation

◆ applyPatch()

void OdTfStorage::applyPatch ( OdStreamBuf s,
OdTfDigestArray roots,
OdTfRevisionControl::ReferenceList refs 
)

Applies a patch created by makePatch() on a storage to get all the changes contained in the patch file transfered to the storage.

Remarks
applyPatch() will fail if any if the path required revisions is not available in the storage (makePatch() "from" parameter).
Parameters
s[in] Stream buffer associated with the patch file.
roots[out] Set of root objects created by the patch (makePatch() "to" parameter).
refs[out] Set of references included in the patch. These won't be set on the storage yet and thus require further processing.

◆ applySchemePatch()

OdTfDigest OdTfStorage::applySchemePatch ( OdStreamBufPtr schemePatch) const

Write in to OdTfStorage schemes

Parameters
schemePatch[in] patch with scheme that created by OdTfStorage::makeSchemePatch(OdTfDigest).
Returns
Scheme digest.

◆ dryMerge() [1/2]

void OdTfStorage::dryMerge ( const OdDbDatabase pDb,
const OdTfDigest theirs,
const OdTfDigest base,
OdTfMergeHandler mergeHandler 
) const

◆ dryMerge() [2/2]

void OdTfStorage::dryMerge ( const OdTfDigest mine,
const OdTfDigest theirs,
const OdTfDigest base,
OdTfMergeHandler mergeHandler 
) const

Dry merge operation for calculating all the changes and conflicts.

Does not perform any real merge operation. Only useful for recording/inspecting callbacks to mergeHandler in order to have the full picture before performing the actual merge operation. The return value of the mergeHandler is ignored.

Parameters
mine[in] Revision to be used as my side for the merge.
pDb[in] The database to be used as my side for the merge.
theirs[in] Revision to be used as their side for merge.
base[in] Common ancestor revision for my and their side.
mergeHandler[in] Callback for recording/inspecting all changes.

◆ getReference()

bool OdTfStorage::getReference ( const OdString refName,
OdTfDigest sha 
) const

Returns the hash of the specified branch.

Parameters
refName[in] Branch name.
sha[out] Hash code of the branch head commit.
Returns
False if the specified branch does not exist; true otherwise.

◆ getReferences()

void OdTfStorage::getReferences ( OdTfRevisionControl::ReferenceList refs) const

Gets a set of branch names and their hashes from the repository.

Parameters
refs[out] Container with branches and their hashes of commit.

◆ getRevisionDifference() [1/2]

void OdTfStorage::getRevisionDifference ( const OdTfDigest newRevision,
const OdTfDigest oldRevision,
OdTfRevisionControl::ChangeList result 
) const

Gets a list of handles of the objects that differ between revisions. Revisions may actually be unrelated.

Parameters
newRevision[in] Hash code of the first revision.
oldRevision[in] Hash code of the second revision.
result[out] A list of changes, containing IDs of objects that differ between revisions.

◆ getRevisionDifference() [2/2]

void OdTfStorage::getRevisionDifference ( OdDbDatabase pDb,
const OdTfDigest revision,
OdTfRevisionControl::ChangeList result 
) const

Gets a list of handles of the objects that differ between a revision and the database.

Parameters
pDb[in] A database to compare with.
revision[in] Hash code of the revision.
result[out] A list of changes, containing IDs of objects that differ between the database and the revision.

◆ getStorageStream()

OdStreamBufPtr OdTfStorage::getStorageStream ( ) const

Retrieves the stream associated with the storage.

Returns
Sream associated with the storage.

◆ isSchemePresent()

bool OdTfStorage::isSchemePresent ( const OdTfDigest sha) const

Checks for the required schema for this revision.

Remarks
The schema is used to update the data to current version and for decompress data.
Parameters
sha[in] Source revision to check scheme
Returns
True if scheme for current revision loaded runtime or placed in storage, otherwise return false.
Remarks
If returned false, need register schema for this revision. Or apply scheme patch ( if it revision was transfer via patch )

◆ makePatch() [1/2]

OdStreamBufPtr OdTfStorage::makePatch ( const OdTfDigestArray from,
const OdTfDigestArray to,
const OdTfRevisionControl::ReferenceList refs = OdTfRevisionControl::ReferenceList() 
) const

Collects all the changes since the "from" set of revisions to the "to" set of revisions. Together with applyPatch() it is designed to transfer changes between storages.

The "from" set of revisions is considered available in the remote storage. So, the objects reachable by these commits should not be included in the patch. The "to" set of revisions are the revisions that need to be made available on the remote. Each names a single revision to be included. So, if all revisions of a branch need to be included, then each revision from that branch needs to included in the "to" set.

Consider following example scenarios:

Remote: – C7 / C0 – C1 – C2 -----— C5 – C6 \ / ^ – C3 – C4 – master

Local: master v C0 – C1 – C2 \ – C3 ^ branch1

If the local storage has revision C3 and wants to update to head of master, it makes a request to the remote 'update({C3}, {master})' which is translated on the remote to 'makePatch({C3}, {C6})'. This will only include the differences between revision C3 and revision C6 into the patch.

If the local repository has two branches up to C2, C3 (C0, C1, C2, C3) and wants to pull the remote changes up to C6, it makes a request to the remote 'pull({C2, C3}, master)' which is translated on the remote to 'makePatch({C0, C1, C2, C3}, {C4, C5, C6})'. This will include all objects from C4, C5 and C6 in the patch not already available in any of the local branches.

This can also be used for the initial clone of a repository by making a request to the remote 'pull({}, master)' which is thus translated to 'makePatch({}, {C0, C1, C2, C3, C4, C5, C6})' which does not include C7 or 'update({}, {master})' which only includes all objects for C6 in the patch.

Parameters
from[in] Set of revision hashes for the starting revisions.
to[in] Set of revision hashes for the ending revisions.
refs[in] Set of references to be included in the patch.
Returns
Pointer to a stream buffer associated with the patch file.

◆ makePatch() [2/2]

void OdTfStorage::makePatch ( OdStreamBuf s,
const OdTfDigestArray from,
const OdTfDigestArray to,
const OdTfRevisionControl::ReferenceList refs 
) const
protected

◆ makeSchemePatch()

OdStreamBufPtr OdTfStorage::makeSchemePatch ( const OdTfDigest sha) const

Create the scheme patch of specific revision

Parameters
sha[in] the revision for which the schema patch will be created
Returns
Pointer to a stream buffer of the scheme. Return null pointer if scheme not found in the OdTfStorage.

◆ merge() [1/2]

OdDbDatabasePtr OdTfStorage::merge ( const OdTfDigest mine,
const OdTfDigest theirs,
const OdTfDigest base,
OdTfMergeHandler mergeHandler 
) const

Merges changes from the repository to the database. Merge operation does not automatically saves the changes, only runtime database is changed.

The mine revision will be retrieve from storage and used as a target database for the merge. It will be returned as the result database (which is not yet stored to the storage).

Parameters
mine[in] Revision to be used as my side for the merge.
theirs[in] Revision to be used as their side for the merge.
base[in] Common ancestor revision for my and their side.
mergeHandler[in/out] Callback for handling merge conflicts.
Returns
A pointer to the database containing the result of the merge of mine and theirs revisions.

◆ merge() [2/2]

void OdTfStorage::merge ( OdDbDatabase pDb,
const OdTfDigest theirs,
const OdTfDigest base,
OdTfMergeHandler mergeHandler 
) const

Merges changes from the repository and database. Merge operation does not automatically saves the changes, only runtime database is changed.

The database passes as my side will be used as the target database for the merge. The object changes will be calculated from this database compared to the base revision.

Parameters
pDb[in/out] A database to merge into. This database is used as my side for the merge.
theirs[in] Revision to be used as their side for the merge.
base[in] Common ancestor revision for my and their side.
mergeHandler[in/out] Callback for handling merge conflicts.

◆ retrieve()

OdDbDatabasePtr OdTfStorage::retrieve ( const OdTfDigest sha,
bool  partial = false 
) const

Retrieves a drawing database from the storage. The database is checked out from a specific revision from the storage. If "partial" is false, all the objects are loaded in memory. If they will be eventually loaded anyway, it is much faster not to set "partial" flag to true.

Parameters
sha[in] Source revision to check out a database from.
partial[in] Flag that determines whether all the objects are loaded in memory (false) or not (true).
Returns
Pointer to the database corresponding to the checked out state.

◆ setReference() [1/2]

void OdTfStorage::setReference ( const OdString refName,
const OdTfDigest sha 
)

Writes a branch with its hash.

Parameters
refName[in] Branch name.
sha[in] Commit hash.

◆ setReference() [2/2]

void OdTfStorage::setReference ( const OdTfRevisionControl::ReferenceList branches)

Writes a set of branches with their hashes.

Parameters
branches[in] Hash of commit.

◆ store()

OdTfDigest OdTfStorage::store ( OdDbDatabase pDb,
const OdDbObjectIdArray objectsToSave = 0 
)

Open an existing .dsf storage or create a new .dsf storage without history tracking.

Parameters
pStream[in] Stream, associated with the storage.
pHostApp[in] Platform specific host application services.
Returns
Pointer to the repository object corresponding to the storage.

Stores a .dwg database into the .dsf storage. Can be used for both the initial import in the repository or for integrating changes made by third party editors.

The returned hash is the only way to access the stored revision of the drawing. There is no way to retrieve the hash of an existing revision, as such the hash should be stored by other external means.

Parameters
pDb[in] Database to be stored in the storage.
objectsToSave[in] List of objects to be saved. Optional. Used to perform a partial revision.
Returns
Hash ID of the created revision in the storage.

Friends And Related Function Documentation

◆ OdTfRevisionControl::beginPartialImport

◆ OdTfStorageImpl

friend struct OdTfStorageImpl
friend

Definition at line 881 of file TfRevisionControl.h.

Member Data Documentation

◆ m_pImpl

OdTfStorageImpl* OdTfStorage::m_pImpl
protected

Definition at line 883 of file TfRevisionControl.h.


The documentation for this struct was generated from the following file: