Esempio n. 1
0
        private Action <StoredProcedureWorkload> BuildWorkloadAction(IDataGenerator generator)
        {
            Action <StoredProcedureWorkload> workloadReloadAction = null;
            object payload = new String('a', 100);

            if (config.Type.Equals("HYBRID"))
            {
                int queryCount = config.QueryCount;
                workloadReloadAction = workload =>
                {
                    HybridYCSBWorkload hybridWorkload = workload as HybridYCSBWorkload;
                    for (int i = 0; i < queryCount; i++)
                    {
                        hybridWorkload.Keys[i]    = generator.NextIntKey();
                        hybridWorkload.Values[i]  = payload;
                        hybridWorkload.Queries[i] = generator.NextOperation();
                    }
                };
            }
            else
            {
                workloadReloadAction = workload =>
                {
                    YCSBWorkload ycsbWorkload = workload as YCSBWorkload;
                    ycsbWorkload.Type  = generator.NextOperation();
                    ycsbWorkload.Key   = generator.NextIntKey();
                    ycsbWorkload.Value = payload;
                };
            }
            return(workloadReloadAction);
        }