public static ClusterTopologyResponse TryLoad(string topologyHash, JsonOperationContext context) { try { var path = GetPath(topologyHash); if (File.Exists(path) == false) { return(null); } using (var stream = SafeFileStream.Create(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var blittableJsonReaderObject = context.Read(stream, "raven-cluster-topology")) { return(JsonDeserializationClient.ClusterTopology(blittableJsonReaderObject)); } } catch (Exception e) { if (_logger.IsInfoEnabled) { _logger.Info("Could not understand the persisted cluster topology", e); } return(null); } }
public static async Task <ClusterTopologyResponse> TryLoadAsync(string topologyHash, DocumentConventions conventions, JsonOperationContext context) { try { if (conventions.DisableTopologyCache) { return(null); } var path = GetPath(topologyHash, conventions); if (File.Exists(path) == false) { return(null); } using (var stream = SafeFileStream.Create(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var json = await context.ReadForMemoryAsync(stream, "raven-cluster-topology").ConfigureAwait(false)) { return(JsonDeserializationClient.ClusterTopology(json)); } } catch (Exception e) { if (_logger.IsInfoEnabled) { _logger.Info("Could not understand the persisted cluster topology", e); } return(null); } }
public override void SetResponse(BlittableJsonReaderObject response, bool fromCache) { if (response == null) { return; } Result = JsonDeserializationClient.ClusterTopology(response); }
public static Topology TryLoadTopologyFromLocalCache(string serverHash, JsonOperationContext context) { try { var path = GetTopologyPath(serverHash); if (File.Exists(path) == false) { return(null); } using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { using (var blittableJsonReaderObject = context.Read(stream, "raven-topology")) { return(JsonDeserializationClient.ClusterTopology(blittableJsonReaderObject)); } } } catch (Exception e) { Log.ErrorException("Could not understand the persisted replication information", e); return(null); } }
public override void SetResponse(BlittableJsonReaderObject response) { Result = JsonDeserializationClient.ClusterTopology(response); }