Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LockListForRW"/> class.
 /// </summary>
 /// <param name="createChangeList">Function to create change list</param>
 /// <param name="lockDownPaths">The paths that must be in lockdown (or null)</param>
 /// <param name="onlyOnEphemeral">Only used on ephemeral</param>
 /// <param name="txId">Transanction ID</param>
 public LockListForRW(Func <IChangeList> createChangeList, LockDownSet lockDownPaths, bool onlyOnEphemeral, long txId)
 {
     this.createChangeList = createChangeList;
     this.lockDownPaths    = lockDownPaths ?? throw new ArgumentNullException("lockDownPaths");
     this.readonlyInterfaceRequiresLocks = true;
     this.onlyOnEphemeral = onlyOnEphemeral;
     this.TxId            = txId;
 }
Exemplo n.º 2
0
        /// <summary>
        /// gets or creates a locklist
        /// </summary>
        /// <param name="req">the request this operation is for</param>
        /// <param name="createChangeList">Function to create change list</param>
        /// <param name="lockDownPaths">if not null, this is a list of paths that are in RW lockdown mode.</param>
        /// <param name="txId">Transaction ID unique in the lifetime of service partition</param>
        /// <returns>the locklist for this thread</returns>
        internal ILockListTransaction GetOrCreateLockList(IRingMasterBackendRequest req, Func <Persistence.IChangeList> createChangeList, LockDownSet lockDownPaths, long txId)
        {
            IOperationOverrides over = req.Overrides;

            ILockListTransaction ll;

            ISessionAuth auth = req.Auth;

            if (auth == null)
            {
                auth = this.authenticationInfo;
            }

            if (this.ROInterfaceRequiresLocks || this.WritesAllowed || !useROLocks)
            {
                ll = new LockListForRW(createChangeList, lockDownPaths, this.OnlyEphemeralChangesAllowed, txId);
            }
            else
            {
                ll = new LockListForRO();
            }

            try
            {
                ll.Initialize(auth, over);
            }
            catch (Exception)
            {
                ll.Dispose();
                throw;
            }

            return(ll);
        }