Example #1
0
        public Status Delete(MixedKey key, MixedContext context, long lsn)
        {
            MixedKeyWrapper *    keyWrapper;
            MixedContextWrapper *contextWrapper;

#if BLIT_KEY && !GENERIC_BLIT_KEY
            keyWrapper = (MixedKeyWrapper *)&key;
#elif GENERIC_BLIT_KEY // implies BLIT_KEY
            {
                keyWrapper = (MixedKeyWrapper *)Unsafe.AsPointer(ref key);
            }
#else
            {
                var w = BlittableTypeWrapper.Create(key);
                keyWrapper = (MixedKeyWrapper *)&w;
            }
#endif
#if BLIT_CONTEXT
            {
                contextWrapper = (MixedContextWrapper *)&context;
            }
#else
            {
                var w = BlittableTypeWrapper.Create(context);
                contextWrapper = (MixedContextWrapper *)w.ptr;
            }
#endif
            var ret = store.Delete(keyWrapper, contextWrapper, lsn);

            if (ret == Status.OK)
            {
#if !BLIT_KEY
                {
                    MixedKeyWrapper.Free(keyWrapper);
                }
#endif
#if !BLIT_CONTEXT
                {
                    MixedContextWrapper.Free(contextWrapper);
                }
#endif
            }

            return(ret);
        }
Example #2
0
        public Status Read(MixedKey key, MixedInput input, ref MixedOutput output, MixedContext context, long lsn)
        {
            MixedKeyWrapper *    keyWrapper;
            MixedInputWrapper *  inputWrapper;
            MixedOutputWrapper * outputWrapper;
            MixedContextWrapper *contextWrapper;


#if BLIT_KEY && !GENERIC_BLIT_KEY
            {
                keyWrapper = (MixedKeyWrapper *)&key;
            }
#elif GENERIC_BLIT_KEY
            {
                keyWrapper = (MixedKeyWrapper *)Unsafe.AsPointer(ref key);
            }
#else
            {
                var w = BlittableTypeWrapper.Create(key);
                keyWrapper = (MixedKeyWrapper *)&w;
            }
#endif
#if BLIT_INPUT && !GENERIC_BLIT_INPUT
            {
                inputWrapper = (MixedInputWrapper *)&input;
            }
#elif GENERIC_BLIT_INPUT
            {
                inputWrapper = (MixedInputWrapper *)Unsafe.AsPointer(ref input);
            }
#else
            {
                var w = BlittableTypeWrapper.Create(input);
                inputWrapper = (MixedInputWrapper *)w.ptr;
            }
#endif
#if BLIT_OUTPUT && !GENERIC_BLIT_OUTPUT
            MixedOutput localOutput = output;
            {
                outputWrapper = (MixedOutputWrapper *)&localOutput;
            }
#elif GENERIC_BLIT_OUTPUT
            {
                outputWrapper = (MixedOutputWrapper *)Unsafe.AsPointer(ref output);
            }
#else
            {
                var w = BlittableTypeWrapper.Create(output);
                outputWrapper = (MixedOutputWrapper *)w.ptr;
            }
#endif
#if BLIT_CONTEXT
            {
                contextWrapper = (MixedContextWrapper *)&context;
            }
#else
            {
                var w = BlittableTypeWrapper.Create(context);
                contextWrapper = (MixedContextWrapper *)w.ptr;
            }
#endif

            var ret =
                store.Read(
                    keyWrapper,
                    inputWrapper,
                    outputWrapper,
                    contextWrapper,
                    lsn);

            if (ret == Status.OK || ret == Status.NOTFOUND)
            {
#if !BLIT_KEY
                {
                    MixedKeyWrapper.Free(keyWrapper);
                }
#endif
#if !BLIT_INPUT
                {
                    MixedInputWrapper.Free(inputWrapper);
                }
#endif

#if BLIT_OUTPUT && !GENERIC_BLIT_OUTPUT
                {
                    output = localOutput;
                }
#else
#if !BLIT_OUTPUT
                {
                    output = ((BlittableTypeWrapper *)(&outputWrapper))->GetObject <MixedOutput>();
                    MixedOutputWrapper.Free(outputWrapper);
                }
#endif
#endif

#if !BLIT_CONTEXT
                {
                    MixedContextWrapper.Free(contextWrapper);
                }
#endif
            }

            return(ret);
        }
Example #3
0
        public Status RMW(MixedKey key, MixedInput input, MixedContext context, long lsn)
        {
            MixedKeyWrapper *    keyWrapper;
            MixedInputWrapper *  inputWrapper;
            MixedContextWrapper *contextWrapper;


#if BLIT_KEY && !GENERIC_BLIT_KEY
            {
                keyWrapper = (MixedKeyWrapper *)&key;
            }
#elif GENERIC_BLIT_KEY // implies BLIT_KEY
            {
                keyWrapper = (MixedKeyWrapper *)Unsafe.AsPointer(ref key);
            }
#else
            {
                var w = BlittableTypeWrapper.Create(key);
                keyWrapper = (MixedKeyWrapper *)&w;
            }
#endif
#if BLIT_INPUT && !GENERIC_BLIT_INPUT
            {
                inputWrapper = (MixedInputWrapper *)&input;
            }
#elif GENERIC_BLIT_INPUT
            {
                inputWrapper = (MixedInputWrapper *)Unsafe.AsPointer(ref input);
            }
#else
            {
                var w = BlittableTypeWrapper.Create(input);
                inputWrapper = (MixedInputWrapper *)w.ptr;
            }
#endif
#if BLIT_CONTEXT
            {
                contextWrapper = (MixedContextWrapper *)&context;
            }
#else
            {
                var w = BlittableTypeWrapper.Create(context);
                contextWrapper = (MixedContextWrapper *)w.ptr;
            }
#endif

            var ret =
                store.RMW(
                    keyWrapper,
                    inputWrapper,
                    contextWrapper,
                    lsn);

            if (ret == Status.OK || ret == Status.NOTFOUND)
            {
#if !BLIT_KEY
                {
                    MixedKeyWrapper.Free(keyWrapper);
                }
#endif
#if !BLIT_INPUT
                {
                    MixedInputWrapper.Free(inputWrapper);
                }
#endif
#if !BLIT_CONTEXT
                {
                    MixedContextWrapper.Free(contextWrapper);
                }
#endif
            }

            return(ret);
        }