Example #1
0
        public void AddTask(Task task)
        {
            var pos = Writer.Position;

            BinaryWriter.Write(task.Index);
            BinaryWriter.Write(task.Type);
            new JsonSerializer().Serialize(new BsonWriter(Writer), task);
            Mutator.IncrementTaskCount();
            task.Id = Mutator.Tasks.Enqueue(pos);
            Mutator.TasksByIndex.Add(new JObject(
                                         new JProperty("Index", task.Index),
                                         new JProperty("Id", task.Id)
                                         ),
                                     DateTime.UtcNow.ToBinary());
        }