Ejemplo n.º 1
0
        public static void InPlaceUpdater(MixedKeyWrapper *key, MixedInputWrapper *input, MixedValueWrapper *value)
        {
            MixedValueWrapper.AcquireWriteLock(value);

            userFunctions.InPlaceUpdater(
                UserType.Convert(key),
                UserType.Convert(input),
                ref UserType.Convert(value));

            MixedValueWrapper.ReleaseWriteLock(value);
        }
Ejemplo n.º 2
0
        public static void ConcurrentReader(MixedKeyWrapper *key, MixedInputWrapper *input, MixedValueWrapper *value, MixedOutputWrapper *dst)
        {
            MixedValueWrapper.AcquireReadLock(value);

            userFunctions.Reader(
                UserType.Convert(key),
                UserType.Convert(input),
                UserType.Convert(value),
                ref UserType.Convert(dst));

            MixedValueWrapper.ReleaseReadLock(value);
        }
Ejemplo n.º 3
0
 public static int InitialValueLength(MixedKeyWrapper *key, MixedInputWrapper *input)
 {
     return(MixedValueWrapper.GetLength(null));
 }
Ejemplo n.º 4
0
 public static void ConcurrentWriter(MixedKeyWrapper *key, MixedValueWrapper *src, MixedValueWrapper *dst)
 {
     MixedValueWrapper.AcquireWriteLock(dst);
     MixedValueWrapper.Copy(src, dst);
     MixedValueWrapper.ReleaseWriteLock(dst);
 }
Ejemplo n.º 5
0
 public static void SingleWriter(MixedKeyWrapper *key, MixedValueWrapper *src, MixedValueWrapper *dst)
 {
     MixedValueWrapper.Copy(src, dst);
 }
Ejemplo n.º 6
0
        public Status Upsert(MixedKey key, MixedValue value, MixedContext context, long lsn)
        {
            MixedKeyWrapper *    keyWrapper;
            MixedValueWrapper *  valueWrapper;
            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_VALUE && !GENERIC_BLIT_VALUE
            {
                valueWrapper = (MixedValueWrapper *)&value;
            }
#elif GENERIC_BLIT_VALUE
            {
                valueWrapper = (MixedValueWrapper *)Unsafe.AsPointer(ref value);
            }
#else
            {
                var w = BlittableTypeWrapper.Create(value);
                valueWrapper = (MixedValueWrapper *)&w;
            }
#endif
#if BLIT_CONTEXT
            {
                contextWrapper = (MixedContextWrapper *)&context;
            }
#else
            {
                var w = BlittableTypeWrapper.Create(context);
                contextWrapper = (MixedContextWrapper *)w.ptr;
            }
#endif

            var ret =
                store.Upsert(
                    keyWrapper,
                    valueWrapper,
                    contextWrapper,
                    lsn);

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

            return(ret);
        }