/** @packageDocumentation
 * @module iModels
 */
import { Id64Arg, Id64String } from "@itwin/core-bentley";
import { LockState } from "@itwin/core-common";
import { BriefcaseDb } from "../IModelDb";
import { LockControl } from "../LockControl";
import { SQLiteDb } from "../SQLiteDb";
import { _close, _elementWasCreated, _implementationProhibited, _releaseAllLocks } from "./Symbols";
export declare class ServerBasedLocks implements LockControl {
    readonly [_implementationProhibited]: undefined;
    get isServerBased(): boolean;
    protected readonly lockDb: SQLiteDb;
    protected readonly briefcase: BriefcaseDb;
    private _removeOnCommitListener;
    private readonly _unsavedChangesTxnId;
    constructor(iModel: BriefcaseDb);
    [_close](): void;
    private getOwners;
    private getLockState;
    /** Clear the cache of locally held locks.
     * Note: does *not* release locks from server.
     */
    private clearAllLocks;
    /** only for tests */
    getLockCount(state: LockState): number;
    [_releaseAllLocks](): Promise<void>;
    releaseAllLocks(): Promise<void>;
    abandonAllLocks(): Promise<void>;
    private insertLock;
    private insertTxnLockRecord;
    private ownerHoldsExclusiveLock;
    /** Determine whether an the exclusive lock is already held by an element (or one of its owners) */
    holdsExclusiveLock(id: Id64String): boolean;
    holdsSharedLock(id: Id64String): boolean;
    /** if the shared lock on the element supplied is not already held, add it to the set of shared locks required. Then, check owners. */
    private addSharedLock;
    /** add owners (recursively) of an element to a list of required shared locks, if not already held. */
    private addOwnerSharedLocks;
    /** attempt to acquire all necessary locks for a set of elements */
    private acquireAllLocks;
    acquireLocks(arg: {
        shared?: Id64Arg;
        exclusive?: Id64Arg;
    }): Promise<void>;
    private abandonLocks;
    abandonLocksForCurrentUnsavedTxn(): Promise<boolean>;
    abandonLocksForReversedTxn(txnId: Id64String): Promise<boolean>;
    private getAbandonedLocksForTxn;
    acquireLocksForReinstatingTxn(txnId: Id64String): Promise<boolean>;
    holdsNecessaryLocksForReinstatingTxn(txnId: Id64String): boolean;
    clearTxnLockRecords(txnId: Id64String): void;
    /** When an element is newly created in a session, we hold the lock on it implicitly. Save that fact. */
    [_elementWasCreated](id: Id64String): void;
    private clearDiscoveredLocks;
    /** locks are not necessary during change propagation. */
    private get _locksAreRequired();
    /** throw if locks are currently required and the exclusive lock is not held on the supplied element */
    checkExclusiveLock(id: Id64String, type: string, operation: string): void;
    /** throw if locks are currently required and a shared lock is not held on the supplied element */
    checkSharedLock(id: Id64String, type: string, operation: string): void;
}
export declare function createServerBasedLocks(iModel: BriefcaseDb): LockControl;
//# sourceMappingURL=ServerBasedLocks.d.ts.map