public static async Task <T> GetItemAsync <T>(this IComponentStagingStore store, string identifier)
        {
            var stream = await store.GetItemAsync(identifier);

            using (var streamReader = new StreamReader(stream))
            {
                var text = await streamReader.ReadToEndAsync();

                return(JsonConvert.DeserializeObject <T>(text));
            }
        }
        private static async Task EnsureAllNeededItemsExistInStore(IComponentStagingStore store)
        {
            var missingKeys = new List <string>();

            foreach (var key in new string[] { DownloadedFileKey_Bytes, DownloadedFileKey_ContentType })
            {
                if (!await store.HasItemAsync(key))
                {
                    missingKeys.Add(key);
                }
            }
            if (missingKeys.Any())
            {
                throw new Exception("Could not send file to archive since there were missing mandator keys in the store. The missing keys were: " + string.Join(", ", missingKeys));
            }
        }
Exemple #3
0
 private CaPMIngestEventStore(IComponentStagingStore componentStagingStore, Guid ingestId)
 {
     this._componentStagingStore = componentStagingStore;
     this._ingestId = ingestId;
 }
 public static Task SetItemAsync <T>(this IComponentStagingStore store, string identifier, T item)
 {
     return(store.SetItemAsync(identifier, new MemoryStream(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(item)))));
 }
 public CachingComponentStagingStore(IComponentStagingStore componentStagingStore)
 {
     this._componentStagingStore = componentStagingStore;
 }