コード例 #1
0
        /**
         * <summary>
         * Wraps cache request into a protocol message.</summary>
         *
         * <param name="req">Cache request that need to be wrapped.</param>
         * <returns>Wrapped message.</returns>
         */
        private static GridClientCacheRequest WrapCacheRequest(ProtoRequest req)
        {
            ProtoCacheRequest data = ProtoCacheRequest.ParseFrom(req.Body);

            GridClientCacheRequest bean = new GridClientCacheRequest((GridClientCacheRequestOperation)data.Operation, Guid.Empty);

            if (data.HasCacheName)
            {
                bean.CacheName = data.CacheName;
            }

            if (data.HasKey)
            {
                bean.Key = WrapObject(data.Key);
            }

            if (data.HasValue)
            {
                bean.Value = WrapObject(data.Value);
            }

            if (data.HasValue2)
            {
                bean.Value2 = WrapObject(data.Value2);
            }

            if (data.HasValues)
            {
                bean.Values = WrapMap(data.Values);
            }

            return(WrapRequest(bean, req));
        }
コード例 #2
0
        /**
         * <summary>
         * Wraps cache request into a protocol message.</summary>
         *
         * <param name="req">Cache request that need to be wrapped.</param>
         * <returns>Wrapped message.</returns>
         */
        private static ProtoRequest WrapCacheRequest(GridClientCacheRequest req)
        {
            ProtoCacheRequest.Builder builder = ProtoCacheRequest.CreateBuilder()
                                                .SetOperation((ProtoCacheRequest.Types.GridCacheOperation)req.Operation);

            if (req.CacheName != null)
            {
                builder.SetCacheName(req.CacheName);
            }

            if (req.CacheFlags != 0)
            {
                builder.SetCacheFlagsOn(req.CacheFlags);
            }

            if (req.Key != null)
            {
                builder.SetKey(WrapObject(req.Key));
            }

            if (req.Value != null)
            {
                builder.SetValue(WrapObject(req.Value));
            }

            if (req.Value2 != null)
            {
                builder.SetValue2(WrapObject(req.Value2));
            }

            if (req.Values != null)
            {
                builder.SetValues(WrapMap(req.Values));
            }

            return(WrapRequest(req, builder.Build()));
        }