private static CobaltStore CreateCobaltStore(IExchangePrincipal exchangePrincipal, Attachment attachment, WacRequest wacRequest, CachedAttachmentInfo attachmentInfo) { if (exchangePrincipal == null) { throw new ArgumentException("exchangePrincipal"); } if (exchangePrincipal.MailboxInfo.IsRemote) { throw new OwaInvalidRequestException("Remote mailboxes are not supported."); } Guid objectGuid = exchangePrincipal.MailboxInfo.MailboxDatabase.ObjectGuid; bool diagnosticsEnabled = WacConfiguration.Instance.DiagnosticsEnabled; MdbCache instance = MdbCache.GetInstance(); string path = instance.GetPath(objectGuid); string correlationId = HttpContext.Current.Request.Headers["X-WOPI-CorrelationID"]; CobaltStore store = new CobaltStore(path, objectGuid.ToString(), correlationId, diagnosticsEnabled, WacConfiguration.Instance.BlobStoreMemoryBudget); using (Stream contentStream = ((StreamAttachment)attachment).GetContentStream(PropertyOpenMode.ReadOnly)) { store.Save(contentStream); } store.Saver.Initialize((string)wacRequest.MailboxSmtpAddress, wacRequest.ExchangeSessionId, WacConfiguration.Instance.AutoSaveInterval, delegate { using (Stream documentStream = store.GetDocumentStream()) { WacRequestHandler.ReplaceAttachmentContent(documentStream, wacRequest); } return(true); }, delegate(Exception exception) { store.SaveFailed(exception); }); return(store); }
private static CobaltStore GetCobaltStore(WacRequest wacRequest) { CachedAttachmentInfo attachmentInfo = WacRequestHandler.GetCachedAttachmentInfo(wacRequest); CobaltStore cobaltStore = attachmentInfo.CobaltStore; if (cobaltStore == null) { lock (attachmentInfo) { cobaltStore = attachmentInfo.CobaltStore; if (cobaltStore == null) { WacRequestHandler.ProcessAttachment(wacRequest, PropertyOpenMode.ReadOnly, delegate(IExchangePrincipal exchangePrincipal, Attachment attachment, Stream stream, bool contentProtected) { if (!WacRequestHandler.MessageIsDraft(wacRequest)) { throw new NotSupportedException("Cell storage requests are only supported for draft items."); } cobaltStore = WacRequestHandler.CreateCobaltStore(exchangePrincipal, attachment, wacRequest, attachmentInfo); }); attachmentInfo.CobaltStore = cobaltStore; } } } return(cobaltStore); }
private static void ProcessCobaltRequest(HttpContext context, WacRequest wacRequest, Action <Enum, string> logDetail) { Stream inputStream = context.Request.InputStream; Stream outputStream = context.Response.OutputStream; CobaltStore cobaltStore = WacRequestHandler.GetCobaltStore(wacRequest); cobaltStore.ProcessRequest(inputStream, outputStream, logDetail); }
private void LogRequestDetails(Action <Enum, string> logDetail, Roundtrip roundtrip, bool exceptionThrown) { string arg = string.Join(" ", from request in roundtrip.RequestBatch.Requests select CobaltStore.GetRequestNameAndPartition(request)); logDetail(WacRequestHandlerMetadata.CobaltOperations, arg); StringBuilder stringBuilder = new StringBuilder(); bool flag = false; foreach (Request request2 in roundtrip.RequestBatch.Requests) { if (request2.Failed) { flag = true; stringBuilder.Append(request2.GetType().Name); stringBuilder.Append(" failed. "); try { string conciseLoggingStatement = Log.GetConciseLoggingStatement(request2, this.userAddress); if (exceptionThrown || request2.Failed) { stringBuilder.AppendLine(conciseLoggingStatement); } } catch (ErrorException) { stringBuilder.AppendLine("Concise logging not supported."); } } } try { roundtrip.ThrowIfAnyError(); } catch (Exception ex) { exceptionThrown = true; stringBuilder.AppendLine("ThrowIfAnyError: " + ex.ToString()); } if (exceptionThrown || flag) { logDetail(WacRequestHandlerMetadata.ErrorDetails, stringBuilder.ToString()); } }
internal static void OnCacheEntryExpired(CachedAttachmentInfo attachmentInfo) { SimulatedWebRequestContext.ExecuteWithoutUserContext("WAC.CacheEntryExpired", delegate(RequestDetailsLogger logger) { WacUtilities.SetEventId(logger, "WAC.CacheEntryExpired"); logger.ActivityScope.SetProperty(OwaServerLogger.LoggerData.PrimarySmtpAddress, attachmentInfo.MailboxSmtpAddress); CobaltStore store = attachmentInfo.CobaltStore; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { store.Saver.SaveAndLogExceptions(logger); }); store.Dispose(); Exception exception = adoperationResult.Exception; if (exception != null) { logger.ActivityScope.SetProperty(ServiceCommonMetadata.GenericErrors, exception.ToString()); } }); }
// Token: 0x060001A2 RID: 418 RVA: 0x00007095 File Offset: 0x00005295 public CobaltServerLockingStore(CobaltStore blobStore) { this.blobStore = blobStore; this.editorsTable = new Dictionary <string, EditorsTableEntry>(); this.editorsTableWaterline = 0UL; }