public Maybe <CloudApplicationDefinition> Inspect()
        {
            var            runtimeSerializer = new CloudFormatter();
            var            definitionBlob    = _blobs.GetBlob <CloudApplicationDefinition>(ContainerName, ApplicationDefinitionBlobName, runtimeSerializer);
            Maybe <byte[]> packageBlob;
            string         packageETag;

            if (definitionBlob.HasValue)
            {
                packageBlob = _blobs.GetBlobIfModified <byte[]>(AssemblyLoader.ContainerName, AssemblyLoader.PackageBlobName, definitionBlob.Value.PackageETag, out packageETag, runtimeSerializer);
                if (!packageBlob.HasValue || definitionBlob.Value.PackageETag == packageETag)
                {
                    return(definitionBlob.Value);
                }
            }
            else
            {
                packageBlob = _blobs.GetBlob <byte[]>(AssemblyLoader.ContainerName, AssemblyLoader.PackageBlobName, out packageETag, runtimeSerializer);
            }

            if (!packageBlob.HasValue)
            {
                return(Maybe <CloudApplicationDefinition> .Empty);
            }

            var definition = Analyze(packageBlob.Value, packageETag);

            _blobs.PutBlob(ContainerName, ApplicationDefinitionBlobName, definition, runtimeSerializer);
            return(definition);
        }
 /// <summary>
 /// Configure a zip container with one or more assemblies as the new cloud services.
 /// </summary>
 public void UploadApplicationZipContainer(byte[] data)
 {
     _blobs.PutBlob(
         AssemblyLoader.ContainerName,
         AssemblyLoader.PackageBlobName,
         data,
         true,
         new CloudFormatter());
 }
        public void Log(LogLevel level, string message, Exception exception = null, XElement meta = null)
        {
            var now = DateTime.UtcNow;

            var blobContent   = FormatLogEntry(now, level, message, exception, meta);
            var blobName      = string.Format("{0}/{1}/", FormatDateTimeNamePrefix(now), level);
            var blobContainer = LevelToContainer(level);

            var attempt = 0;

            while (!_blobStorage.PutBlob(blobContainer, blobName + attempt, blobContent, false))
            {
                attempt++;
            }
        }
Beispiel #4
0
        /// <summary>
        /// Set or update the cloud configuration file.
        /// </summary>
        public void SetConfiguration(string configuration)
        {
            if (configuration == null)
            {
                RemoveConfiguration();
                return;
            }

            configuration = configuration.Trim();
            if (String.IsNullOrEmpty(configuration))
            {
                RemoveConfiguration();
                return;
            }

            _blobs.PutBlob(
                AssemblyLoader.ContainerName,
                AssemblyLoader.ConfigurationBlobName,
                _encoding.GetBytes(configuration),
                _runtimeSerializer);
        }
Beispiel #5
0
 /// <summary>Push the blob only if etag is matching the etag of the blob in BlobStorage</summary>
 public static bool PutBlob <T>(this IBlobStorageProvider provider, IBlobLocationAndType <T> location, T item, string etag, IDataSerializer serializer = null)
 {
     return(provider.PutBlob(location.ContainerName, location.Path, item, etag, serializer));
 }
Beispiel #6
0
 public static bool PutBlob <T>(this IBlobStorageProvider provider, IBlobLocation location, T item, bool overwrite, IDataSerializer serializer = null)
 {
     return(provider.PutBlob(location.ContainerName, location.Path, item, overwrite, serializer));
 }
Beispiel #7
0
 public static void PutBlob <T>(this IBlobStorageProvider provider, IBlobLocation location, T item, IDataSerializer serializer = null)
 {
     provider.PutBlob(location.ContainerName, location.Path, item, serializer);
 }
 public void BlobHasEtag()
 {
     BlobStorage.PutBlob(ContainerName, BlobName, 1);
     Assert.IsNotNull(BlobStorage.GetBlobEtag(ContainerName, BlobName), "#A00");
 }
Beispiel #9
0
 /// <summary>
 /// Enable a cloud service
 /// </summary>
 public void EnableService(string serviceName)
 {
     _blobs.PutBlob(new CloudServiceStateName(serviceName), CloudServiceState.Started, _runtimeSerializer);
 }
Beispiel #10
0
 /// <summary>Reset the counter at the given value.</summary>
 public void Reset(decimal value)
 {
     _provider.PutBlob(_containerName, _blobName, value);
 }