예제 #1
0
            protected virtual bool Lookup(DatastoreKey key, out IDatastoreBatch <T> batch, out DatastoreKey rest)
            {
                IDatastore <T> child;
                DatastoreKey   loc;

                if (!_ds.Lookup(key, out child, out loc, out rest))
                {
                    batch = null;
                    return(false);
                }

                if (_mounts.ContainsKey(loc))
                {
                    batch = _mounts[loc];
                    return(true);
                }

                var bds = child as IBatchingDatastore <T>;

                if (bds == null)
                {
                    throw new Exception("batch not supported");
                }

                batch = bds.Batch();
                _mounts.Add(loc, batch);
                return(true);
            }
 protected override bool Lookup(DatastoreKey key, out IDatastoreBatch <T> batch, out DatastoreKey rest)
 {
     _lock.EnterWriteLock();
     try
     {
         return(base.Lookup(key, out batch, out rest));
     }
     finally
     {
         _lock.ExitWriteLock();
     }
 }
예제 #3
0
 public TransformBatch(IDatastoreBatch <T> child, KeyMapping convert)
 {
     _child   = child;
     _convert = convert;
 }
예제 #4
0
 public SynchronizedBatch(IDatastoreBatch <T> batch, ReaderWriterLockSlim @lock)
 {
     _batch = batch;
     _lock  = @lock;
 }