コード例 #1
0
 public AzureEventStoreClient(AzureStoreConfiguration config, EventStoreId storeId, string serverEndpoint = null)
     : base(storeId, serverEndpoint)
 {
     Config = config;
     _blob  = config.GetPageBlob(storeId.Name + "/stream.dat");
     _blob.Container.CreateIfNotExist();
 }
コード例 #2
0
 public AzureEventStoreClient(AzureStoreConfiguration config, EventStoreId storeId, string serverEndpoint = null)
     : base(storeId, serverEndpoint)
 {
     Config = config;
     _blob = config.GetPageBlob(storeId.Name + "/stream.dat");
     _blob.Container.CreateIfNotExist();
 }
コード例 #3
0
 public static AzureEventStore OpenExistingForReading(AzureStoreConfiguration config, EventStoreId container)
 {
     var blob = config.GetPageBlob(container.Name + "/stream.dat");
     var check = AzureEventPointer.OpenReadable(blob);
     blob.FetchAttributes();
     var store = AzureEventStoreChunk.OpenExistingForReading(blob, blob.Properties.Length);
     return new AzureEventStore(container, store, check);
 }
コード例 #4
0
 public static AzureEventStore OpenExistingForWriting(AzureStoreConfiguration config, EventStoreId container)
 {
     var blob = config.GetPageBlob(container.Name + "/stream.dat");
     var check = AzureEventPointer.OpenWriteable(blob);
     var offset = check.Read();
     var length = blob.Properties.Length;
     var store = AzureEventStoreChunk.OpenExistingForWriting(blob, offset, length);
     return new AzureEventStore(container, store, check);
 }
コード例 #5
0
        public static AzureEventStore CreateNewForWriting(AzureStoreConfiguration config, EventStoreId container)
        {
            var blob = config.GetPageBlob(container.Name + "/stream.dat");
            blob.Container.CreateIfNotExist();

            var store = AzureEventStoreChunk.CreateNewForWriting(blob);
            var check = AzureEventPointer.OpenWriteable(blob);

            return new AzureEventStore(container, store, check);
        }
コード例 #6
0
        public static AzureEventStore OpenExistingForReading(AzureStoreConfiguration config, EventStoreId container)
        {
            var blob  = config.GetPageBlob(container.Name + "/stream.dat");
            var check = AzureEventPointer.OpenReadable(blob);

            blob.FetchAttributes();
            var store = AzureEventStoreChunk.OpenExistingForReading(blob, blob.Properties.Length);

            return(new AzureEventStore(container, store, check));
        }
コード例 #7
0
        public static AzureEventStore OpenExistingForWriting(AzureStoreConfiguration config, EventStoreId container)
        {
            var blob   = config.GetPageBlob(container.Name + "/stream.dat");
            var check  = AzureEventPointer.OpenWriteable(blob);
            var offset = check.Read();
            var length = blob.Properties.Length;
            var store  = AzureEventStoreChunk.OpenExistingForWriting(blob, offset, length);

            return(new AzureEventStore(container, store, check));
        }
コード例 #8
0
        public static AzureEventStore CreateNewForWriting(AzureStoreConfiguration config, EventStoreId container)
        {
            var blob = config.GetPageBlob(container.Name + "/stream.dat");

            blob.Container.CreateIfNotExist();

            var store = AzureEventStoreChunk.CreateNewForWriting(blob);
            var check = AzureEventPointer.OpenWriteable(blob);

            return(new AzureEventStore(container, store, check));
        }
コード例 #9
0
        public void Handle(ClientMessage.ImportEvents msg)
        {
            Log.Info("Got import request for {0} bytes", msg.Size);
            var watch = Stopwatch.StartNew();
            var count = 0;
            var size  = 0;
            var blob  = _config.GetPageBlob(msg.StagingLocation);

            _manager.AppendEventsToStore(msg.StoreId, msg.StreamId, EnumerateStaging(blob, msg.Size).Select(bytes =>
            {
                count += 1;
                size  += bytes.Length;
                return(bytes);
            }));
            var totalSeconds = watch.Elapsed.TotalSeconds;
            var speed        = size / totalSeconds;

            Log.Info("Import {0} in {1}sec: {2} m/s or {3}", count, Math.Round(totalSeconds, 4), Math.Round(count / totalSeconds), FormatEvil.SpeedInBytes(speed));

            msg.Envelope(new ClientMessage.ImportEventsCompleted());

            ThreadPool.QueueUserWorkItem(state => CleanupBlob(blob));
        }
コード例 #10
0
 public static bool IsValid(AzureStoreConfiguration config, EventStoreId container)
 {
     var store = config.GetPageBlob(container.Name + "/stream.dat");
     return Exists(store);
 }
コード例 #11
0
        public static bool IsValid(AzureStoreConfiguration config, EventStoreId container)
        {
            var store = config.GetPageBlob(container.Name + "/stream.dat");

            return(Exists(store));
        }