Пример #1
0
            public void UpdateReplications(CounterStorageReplicationDocument newReplicationDocument)
            {
                using (var memoryStream = new MemoryStream())
                    using (var streamWriter = new StreamWriter(memoryStream))
                        using (var jsonTextWriter = new JsonTextWriter(streamWriter))
                        {
                            new JsonSerializer().Serialize(jsonTextWriter, newReplicationDocument);
                            streamWriter.Flush();
                            memoryStream.Position = 0;
                            metadata.Add((Slice)"replication", memoryStream);
                        }

                parent.ReplicationTask.SignalCounterUpdate();
            }
Пример #2
0
            public async Task SaveReplications(CounterStorageReplicationDocument newReplicationDocument)
            {
                var requestUriString = String.Format("{0}/replications/save", counterStorageUrl);

                using (var request = jsonRequestFactory.CreateHttpJsonRequest(new CreateHttpJsonRequestParams(this, requestUriString, "POST", credentials, convention)))
                {
                    try
                    {
                        await request.WriteAsync(RavenJObject.FromObject(newReplicationDocument));

                        var response = await request.ReadResponseJsonAsync();
                    }
                    catch (Exception e)
                    {
                        throw e;
                        //throw e.TryThrowBetterError();
                    }
                }
            }
Пример #3
0
			public void UpdateReplications(CounterStorageReplicationDocument newReplicationDocument)
			{
				using (var memoryStream = new MemoryStream())
				using (var streamWriter = new StreamWriter(memoryStream))
				using (var jsonTextWriter = new JsonTextWriter(streamWriter))
				{
					new JsonSerializer().Serialize(jsonTextWriter, newReplicationDocument);
					streamWriter.Flush();
					memoryStream.Position = 0;
					metadata.Add("replication", memoryStream);
				}

				parent.ReplicationTask.SignalCounterUpdate();
			}