<commit_before>﻿#region (c) 2010-2011 Lokad - CQRS for Windows Azure - New BSD License 

// Copyright (c) Lokad 2010-2011, http://www.lokad.com
// This code is released as Open Source under the terms of the New BSD Licence

#endregion

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.WindowsAzure.StorageClient;
using ProtoBuf;

namespace Lokad.Cqrs.Feature.AzurePartition
{
    public sealed class StatelessAzureFutureList
    {
        readonly IEnvelopeStreamer _streamer;

        readonly CloudBlobContainer _container;
        readonly CloudBlob _blob;


        public StatelessAzureFutureList(CloudBlobContainer container, IEnvelopeStreamer streamer)
        {
            _streamer = streamer;
            _container = container;
            _blob = _container.GetBlobReference("__schedule.bin");
        }

        public void Initialize()
        {
            _container.CreateIfNotExist();<commit_msg>Avoiding storage exceptions on the trace for the empty scheduling system.<commit_after>﻿#region (c) 2010-2011 Lokad - CQRS for Windows Azure - New BSD License 

// Copyright (c) Lokad 2010-2011, http://www.lokad.com
// This code is released as Open Source under the terms of the New BSD Licence

#endregion

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.WindowsAzure.StorageClient;
using ProtoBuf;

namespace Lokad.Cqrs.Feature.AzurePartition
{
    public sealed class StatelessAzureFutureList
    {
        readonly IEnvelopeStreamer _streamer;

        readonly CloudBlobContainer _container;
        readonly CloudBlob _blob;


        public StatelessAzureFutureList(CloudBlobContainer container, IEnvelopeStreamer streamer)
        {
            _streamer = streamer;
            _container = container;
            _blob = _container.GetBlobReference("__schedule.bin");
        }

        public void Initialize()
        {
            if (_container.CreateIfNotExist())
            {
                // not required, but avoids Azure exceptions
                using (var memory = new MemoryStream())
                {
                    Serializer.Serialize(memory, new ScheduleItem());
                    _blob.UploadByteArray(memory.ToArray());
                }
            }
{'fraction_non_alphanumeric': 0.07105719237435008, 'fraction_numerical': 0.01386481802426343, 'mean_word_length': 2.5909797822706064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '985105', 'n_tokens_mistral': 634, 'n_tokens_neox': 585, 'n_words': 173}