Exemple #1
0
        private static void ReverseFunction(IGearmanJob <byte[], byte[]> job)
        {
            var str      = Encoding.ASCII.GetString(job.FunctionArgument);
            var strArray = str.ToCharArray();

            Array.Reverse(strArray);
            var reversedStr = new string(strArray);

            job.Complete(Encoding.ASCII.GetBytes(reversedStr));
        }
Exemple #2
0
        public void GetOembedsFunction(IGearmanJob <IList <string>, IList <OEmbed> > job)
        {
            var urls    = job.FunctionArgument;
            var oembeds = new List <OEmbed>();

            foreach (var url in urls)
            {
                // ... fetch oEmbeds ...
            }

            job.Complete(oembeds);
        }
Exemple #3
0
        public void GetOembedsFunction(IGearmanJob<IList<string>, IList<OEmbed>> job)
        {
            var urls = job.FunctionArgument;
            var oembeds = new List<OEmbed>();

            foreach (var url in urls)
            {
                // ... fetch oEmbeds ...
            }

            job.Complete(oembeds);
        }
Exemple #4
0
        private static void DoReverse(IGearmanJob<string, string> job)
        {
            Console.WriteLine("Got job with handle: {0}, function: {1}", job.Info.JobHandle, job.Info.FunctionName);

            var str = job.FunctionArgument;

            var strArray = str.ToCharArray();
            Array.Reverse(strArray);
            var reversedStr = new string(strArray);

            Console.WriteLine("  Reversed: {0}", reversedStr);

            job.Complete(reversedStr);
        }
Exemple #5
0
        private static void DoReverse(IGearmanJob <string, string> job)
        {
            Console.WriteLine("Got job with handle: {0}, function: {1}", job.Info.JobHandle, job.Info.FunctionName);

            var str = job.FunctionArgument;

            var strArray = str.ToCharArray();

            Array.Reverse(strArray);
            var reversedStr = new string(strArray);

            Console.WriteLine("  Reversed: {0}", reversedStr);

            job.Complete(reversedStr);
        }
Exemple #6
0
        private static void DoReverseWithStatus(IGearmanJob<string, string> job)
        {
            Console.WriteLine("Got job with handle: {0}, function: {1}", job.Info.JobHandle, job.Info.FunctionName);

            var str = job.FunctionArgument;
            job.SetStatus(0, (uint)str.Length);
            var reversedArray = new char[str.Length];
            for (int i = 0; i < str.Length; i++)
            {
                reversedArray[str.Length - i - 1] = str[i];
                job.SetStatus((uint)i+1, (uint)str.Length);
            }

            var reversedStr = new string(reversedArray);
            Console.WriteLine("  Reversed: {0}", reversedStr);

            job.Complete(reversedStr);
        }
Exemple #7
0
        private static void DoReverseWithStatus(IGearmanJob <string, string> job)
        {
            Console.WriteLine("Got job with handle: {0}, function: {1}", job.Info.JobHandle, job.Info.FunctionName);

            var str = job.FunctionArgument;

            job.SetStatus(0, (uint)str.Length);
            var reversedArray = new char[str.Length];

            for (int i = 0; i < str.Length; i++)
            {
                reversedArray[str.Length - i - 1] = str[i];
                job.SetStatus((uint)i + 1, (uint)str.Length);
            }

            var reversedStr = new string(reversedArray);

            Console.WriteLine("  Reversed: {0}", reversedStr);

            job.Complete(reversedStr);
        }
Exemple #8
0
 private static void ReverseFunction(IGearmanJob<byte[], byte[]> job)
 {
     var str = Encoding.ASCII.GetString(job.FunctionArgument);
     var strArray = str.ToCharArray();
     Array.Reverse(strArray);
     var reversedStr = new string(strArray);
     job.Complete(Encoding.ASCII.GetBytes(reversedStr));
 }