/** @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;
    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>;
    private insertLock;
    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>;
    /** When an element is newly created in a session, we hold the lock on it implicitly. Save that fact. */
    [_elementWasCreated](id: Id64String): void;
    /** 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