コード例 #1
0
        public static List <(WriteObject, WriteObject)> GetModified(string firstRunId, string secondRunId)
        {
            var output = new List <(WriteObject, WriteObject)>();

            Connections.AsParallel().ForAll(cxn =>
            {
                using var cmd = new SqliteCommand(SQL_GET_COLLECT_MODIFIED, cxn.Connection, cxn.Transaction);
                cmd.Parameters.AddWithValue("@first_run_id", firstRunId);
                cmd.Parameters.AddWithValue("@second_run_id", secondRunId);
                using var reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    var aRunId      = reader["a_run_id"].ToString();
                    var bRunId      = reader["b_run_id"].ToString();
                    var aResultType = reader["a_result_type"].ToString();
                    var bResultType = reader["b_result_type"].ToString();

                    if (aRunId != null && bRunId != null && aResultType != null && bResultType != null)
                    {
                        var val1 = WriteObject.FromString((string)reader["a_serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), aResultType), aRunId);
                        var val2 = WriteObject.FromString((string)reader["b_serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), bResultType), bRunId);

                        if (val1 is WriteObject V1 && val2 is WriteObject V2)
                        {
                            output.Add((V1, V2));
                        }
                    }
                }
            });

            return(output);
        }
コード例 #2
0
        public static List <WriteObject> GetAllMissingExplicit(string firstRunId, string secondRunId)
        {
            var output = new List <WriteObject>();

            Connections.AsParallel().ForAll(cxn =>
            {
                using var cmd = new SqliteCommand(SQL_GET_UNIQUE_BETWEEN_RUNS_EXPLICIT, cxn.Connection, cxn.Transaction);
                cmd.Parameters.AddWithValue("@first_run_id", firstRunId);
                cmd.Parameters.AddWithValue("@second_run_id", secondRunId);
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var runId            = reader["run_id"].ToString();
                        var resultTypeString = reader["result_type"].ToString();
                        if (runId != null && resultTypeString != null)
                        {
                            var wo = WriteObject.FromString((string)reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId);
                            if (wo is WriteObject WO)
                            {
                                output.Add(WO);
                            }
                        }
                    }
                }
            });

            return(output);
        }
コード例 #3
0
        public static List <WriteObject> GetAllMissing2(string firstRunId, string secondRunId)
        {
            string SQL_GROUPED = "SELECT run_id, result_type, serialized FROM collect WHERE run_id = @first_run_id OR run_id = @second_run_id AND identity in (SELECT identity FROM collect WHERE run_id = @first_run_id OR run_id = @second_run_id GROUP BY identity HAVING COUNT(*) == 1);";
            var    output      = new List <WriteObject>();

            Connections.AsParallel().ForAll(cxn =>
            {
                using var cmd = new SqliteCommand(SQL_GROUPED, cxn.Connection, cxn.Transaction);
                cmd.Parameters.AddWithValue("@first_run_id", firstRunId);
                cmd.Parameters.AddWithValue("@second_run_id", secondRunId);
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var runId            = reader["run_id"].ToString();
                        var resultTypeString = reader["result_type"].ToString();
                        if (runId != null && resultTypeString != null)
                        {
                            var wo = WriteObject.FromString((string)reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId);
                            if (wo is WriteObject WO)
                            {
                                output.Add(WO);
                            }
                        }
                    }
                }
            });

            return(output);
        }
コード例 #4
0
        public static IEnumerable <WriteObject> GetResultsByRunid(string runid)
        {
            foreach (var cxn in Connections)
            {
                using var cmd = new SqliteCommand(SQL_GET_RESULTS_BY_RUN_ID, cxn.Connection, cxn.Transaction);

                cmd.Parameters.AddWithValue("@run_id", runid);
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var runId            = reader["run_id"].ToString();
                        var resultTypeString = reader["result_type"].ToString();
                        if (runId != null && resultTypeString != null)
                        {
                            var wo = WriteObject.FromString((string)reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId);
                            if (wo is WriteObject WO)
                            {
                                yield return(WO);
                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
        public virtual void WriteToObject(WriteObject obj)
        {
            obj.WriteInt8("test_byte", test_byte);
            obj.WriteInt16("test_short", test_short);
            obj.WriteInt32("test_int", test_int);
            obj.WriteInt64("test_long", test_long);
            obj.WriteFloat("test_float", test_float);

            obj.WriteInt8Array("test_byte_array", test_byte_array);
            obj.WriteInt16Array("test_short_array", test_short_array);
            obj.WriteInt32Array("test_int_array", test_int_array);
            obj.WriteInt64Array("test_long_array", test_long_array);
            obj.WriteFloatArray("test_float_array", test_float_array);

            obj.WriteString("test_string", test_string);
            obj.WriteStringArray("test_string_array", test_string_array);

            obj.WriteBool("test_bool_1", test_bool_1);
            obj.WriteBool("test_bool_2", test_bool_2);

            obj.WriteDouble("test_double", test_double);
            obj.WriteDoubleArray("test_double_array", test_double_array);

            obj.WriteStringEnum("test_enum", test_enum, new string[] { "DEFAULT", "VALUE_1", "VALUE_2", "VALUE_3" });
        }
コード例 #6
0
        public static ConcurrentBag <WriteObject> GetMissingFromFirst(string firstRunId, string secondRunId)
        {
            var output = new ConcurrentBag <WriteObject>();

            Connections.AsParallel().ForAll(cxn =>
            {
                using var cmd = new SQLiteCommand(SQL_GET_COLLECT_MISSING_IN_B, cxn.Connection, cxn.Transaction);
                cmd.Parameters.AddWithValue("@first_run_id", firstRunId);
                cmd.Parameters.AddWithValue("@second_run_id", secondRunId);
                using (var reader = cmd.ExecuteReader())
                    while (reader.Read())
                    {
                        var runId            = reader["run_id"].ToString();
                        var resultTypeString = reader["result_type"].ToString();
                        if (runId != null && resultTypeString != null)
                        {
                            var wo = WriteObject.FromBytes((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId);
                            if (wo is WriteObject WO)
                            {
                                output.Add(WO);
                            }
                        }
                    }
            });

            return(output);
        }
コード例 #7
0
 public static void Write(CollectObject?colObj, string?runId)
 {
     if (colObj != null && runId != null)
     {
         var objIn = new WriteObject(colObj, runId);
         Connections[ModuloString(objIn.Identity, shardingFactor: dbSettings.ShardingFactor)].WriteQueue.Add(objIn);
     }
 }
コード例 #8
0
        public static void Write(CollectObject colObj, string runId)
        {
            if (colObj != null && runId != null)
            {
                var objIn = new WriteObject(colObj, runId);

                if (objIn.Shard >= 0)
                {
                    Connections[objIn.Shard].WriteQueue.Enqueue(objIn);
                }
            }
        }
コード例 #9
0
        public override void WriteToObject(WriteObject obj)
        {
            base.WriteToObject(obj);

            WriteObject o = new WriteObject();

            test_object.WriteToObject(o);
            obj.WriteChildObject("test_object", o);

            WriteObject[] os = new WriteObject[test_object_array.Length];
            for (int i = 0; i < os.Length; i++)
            {
                os[i] = new WriteObject();
                test_object_array[i].WriteToObject(os[i]);
            }
            obj.WriteChildObjectArray("test_object_array", os);
        }
コード例 #10
0
 public static LogMethods CreateLogMethodsFromObjectMethods(WriteObject writeMessage, WriteObjectException writeObjectException, WriteObjectWithException writeMessageWithException)
 {
     return(new LogMethods(x => writeMessage(x), (x) => writeObjectException(x), (x, y) => writeMessageWithException(x, y)));
 }
コード例 #11
0
 public ObjectSerType(WriteObject value)
 {
     this.value = value;
 }
コード例 #12
0
 public ReadWriteObject(WriteObject write, ReadObject read)
 {
     Write = write;
     Read  = read;
 }