//PROTOBUF
        protected CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager, string cacheId)
        {
            CommandInfo cmdInfo     = new CommandInfo();
            int         packageSize = 0;
            int         index       = 0;
            string      version     = string.Empty;

            switch (command.type)
            {
            case Alachisoft.NCache.Common.Protobuf.Command.Type.ADD_BULK:
                Alachisoft.NCache.Common.Protobuf.BulkAddCommand bulkAddCommand = command.bulkAddCommand;

                packageSize = bulkAddCommand.addCommand.Count;

                cmdInfo.Keys             = new string[packageSize];
                cmdInfo.UpdateCallbackId = new short[packageSize];
                cmdInfo.UpdateDataFilter = new int[packageSize];
                cmdInfo.RemoveCallbackId = new short[packageSize];
                cmdInfo.RemoveDataFilter = new int[packageSize];
                cmdInfo.CallbackEnteries = new CallbackEntry[packageSize];
                cmdInfo.EvictionHint     = new PriorityEvictionHint[packageSize];
                cmdInfo.ExpirationHint   = new ExpirationHint[packageSize];
                cmdInfo.Flags            = new BitSet[packageSize];
                cmdInfo.Values           = new object[packageSize];
                cmdInfo.QueryInfo        = new Hashtable[packageSize];

                cmdInfo.RequestId         = bulkAddCommand.requestId.ToString();
                cmdInfo.ClientLastViewId  = command.clientLastViewId;
                cmdInfo.IntendedRecipient = command.intendedRecipient;
                foreach (Alachisoft.NCache.Common.Protobuf.AddCommand addCommand in bulkAddCommand.addCommand)
                {
                    cmdInfo.Keys[index]             = addCommand.key;
                    cmdInfo.UpdateCallbackId[index] = (short)addCommand.updateCallbackId;

                    if (addCommand.updateDataFilter != -1)
                    {
                        cmdInfo.UpdateDataFilter[index] = addCommand.updateDataFilter;
                    }
                    else
                    {
                        cmdInfo.UpdateDataFilter[index] = (int)EventDataFilter.None;
                    }

                    cmdInfo.RemoveCallbackId[index] = (short)addCommand.removeCallbackId;

                    if (addCommand.removeDataFilter != -1)
                    {
                        cmdInfo.RemoveDataFilter[index] = addCommand.removeDataFilter;
                    }
                    else
                    {
                        cmdInfo.RemoveDataFilter[index] = (int)EventDataFilter.DataWithMetadata;
                    }

                    cmdInfo.EvictionHint[index]   = new PriorityEvictionHint((CacheItemPriority)addCommand.priority);
                    cmdInfo.ExpirationHint[index] = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetExpirationHintObj(addCommand.absExpiration, addCommand.sldExpiration, serailizationContext);
                    cmdInfo.Flags[index]          = new BitSet((byte)addCommand.flag);

                    CallbackEntry cbEntry = null;
                    if (cmdInfo.UpdateCallbackId[index] != -1 || cmdInfo.RemoveCallbackId[index] != -1)
                    {
                        cbEntry = new CallbackEntry(ClientId,
                                                    Convert.ToInt32(cmdInfo.RequestId),
                                                    cmdInfo.Values[index],
                                                    cmdInfo.RemoveCallbackId[index],
                                                    cmdInfo.UpdateCallbackId[index],
                                                    cmdInfo.Flags[index],
                                                    (EventDataFilter)cmdInfo.UpdateDataFilter[index],
                                                    (EventDataFilter)cmdInfo.RemoveDataFilter[index]
                                                    );
                    }

                    cmdInfo.CallbackEnteries[index] = cbEntry;

                    Hashtable queryInfo = new Hashtable();

                    version = command.version;

                    if (string.IsNullOrEmpty(version))
                    {
                        queryInfo["query-info"] = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(addCommand.queryInfo);
                    }
                    else
                    {
                        ObjectQueryInfo objectQueryInfo;

                        objectQueryInfo = addCommand.objectQueryInfo;

                        queryInfo["query-info"] = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(objectQueryInfo.queryInfo);
                    }

                    cmdInfo.QueryInfo[index] = queryInfo;
                    cmdInfo.Values[index]    = UserBinaryObject.CreateUserBinaryObject(addCommand.data.ToArray());

                    index++;
                }

                break;

            case Alachisoft.NCache.Common.Protobuf.Command.Type.INSERT_BULK:
                Alachisoft.NCache.Common.Protobuf.BulkInsertCommand bulkInsertCommand = command.bulkInsertCommand;

                packageSize = bulkInsertCommand.insertCommand.Count;

                cmdInfo.Keys              = new string[packageSize];
                cmdInfo.UpdateCallbackId  = new short[packageSize];
                cmdInfo.UpdateDataFilter  = new int[packageSize];
                cmdInfo.RemoveCallbackId  = new short[packageSize];
                cmdInfo.RemoveDataFilter  = new int[packageSize];
                cmdInfo.CallbackEnteries  = new CallbackEntry[packageSize];
                cmdInfo.EvictionHint      = new PriorityEvictionHint[packageSize];
                cmdInfo.ExpirationHint    = new ExpirationHint[packageSize];
                cmdInfo.Flags             = new BitSet[packageSize];
                cmdInfo.Values            = new object[packageSize];
                cmdInfo.QueryInfo         = new Hashtable[packageSize];
                cmdInfo.RequestId         = bulkInsertCommand.requestId.ToString();
                cmdInfo.ClientLastViewId  = command.clientLastViewId;
                cmdInfo.IntendedRecipient = command.intendedRecipient;
                foreach (Alachisoft.NCache.Common.Protobuf.InsertCommand insertCommand in bulkInsertCommand.insertCommand)
                {
                    cmdInfo.Keys[index]             = insertCommand.key;
                    cmdInfo.UpdateCallbackId[index] = (short)insertCommand.updateCallbackId;
                    cmdInfo.RemoveCallbackId[index] = (short)insertCommand.removeCallbackId;

                    if (insertCommand.updateDataFilter != -1)
                    {
                        cmdInfo.UpdateDataFilter[index] = insertCommand.updateDataFilter;
                    }
                    else
                    {
                        cmdInfo.UpdateDataFilter[index] = (int)EventDataFilter.None;
                    }
                    //for old clients eventdata filter will be missing
                    if (insertCommand.removeDataFilter != -1)
                    {
                        cmdInfo.RemoveDataFilter[index] = insertCommand.removeDataFilter;
                    }
                    else
                    {
                        cmdInfo.RemoveDataFilter[index] = (int)EventDataFilter.DataWithMetadata;
                    }

                    cmdInfo.EvictionHint[index]   = new PriorityEvictionHint((CacheItemPriority)insertCommand.priority);
                    cmdInfo.ExpirationHint[index] = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetExpirationHintObj(insertCommand.absExpiration, insertCommand.sldExpiration, serailizationContext);
                    cmdInfo.Flags[index]          = new BitSet((byte)insertCommand.flag);

                    CallbackEntry cbEntry = null;
                    if (cmdInfo.UpdateCallbackId[index] != -1 || cmdInfo.RemoveCallbackId[index] != -1)
                    {
                        cbEntry = new CallbackEntry(ClientId,
                                                    Convert.ToInt32(cmdInfo.RequestId),
                                                    cmdInfo.Values[index],
                                                    cmdInfo.RemoveCallbackId[index],
                                                    cmdInfo.UpdateCallbackId[index],
                                                    cmdInfo.Flags[index],
                                                    (EventDataFilter)cmdInfo.UpdateDataFilter[index],
                                                    (EventDataFilter)cmdInfo.RemoveDataFilter[index]
                                                    );
                    }

                    cmdInfo.CallbackEnteries[index] = cbEntry;


                    Hashtable queryInfo = new Hashtable();
                    version = command.version;

                    if (string.IsNullOrEmpty(version))
                    {
                        queryInfo["query-info"] = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(insertCommand.queryInfo);
                    }
                    else
                    {
                        ObjectQueryInfo objectQueryInfo;

                        objectQueryInfo         = insertCommand.objectQueryInfo;
                        queryInfo["query-info"] = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(objectQueryInfo.queryInfo);
                    }

                    cmdInfo.QueryInfo[index] = queryInfo;
                    cmdInfo.Values[index]    = UserBinaryObject.CreateUserBinaryObject(insertCommand.data.ToArray());

                    index++;
                }

                break;
            }

            return(cmdInfo);
        }
Esempio n. 2
0
        public BulkAddCommand(string[] keys, CacheItem[] items, Cache parent, string cacheId)
        {
            base.name = "BulkAddCommand";
            _parent   = parent;

            _bulkAddCommand           = new Alachisoft.NCache.Common.Protobuf.BulkAddCommand();
            _bulkAddCommand.requestId = base.RequestId;
            base.BulkKeys             = keys;

            for (int i = 0; i < keys.Length; i++)
            {
                CacheItem item = items[i];

                _addCommand     = new Alachisoft.NCache.Common.Protobuf.AddCommand();
                _addCommand.key = keys[i];

                Alachisoft.NCache.Caching.UserBinaryObject ubObject = Alachisoft.NCache.Caching.UserBinaryObject.CreateUserBinaryObject((byte[])item.Value);
                _addCommand.data.AddRange(ubObject.DataList);

                if (item.AbsoluteExpiration != Cache.NoAbsoluteExpiration)
                {
                    _addCommand.absExpiration = item.AbsoluteExpiration.Ticks;
                }

                if (item.SlidingExpiration != Cache.NoSlidingExpiration)
                {
                    _addCommand.sldExpiration = item.SlidingExpiration.Ticks;
                }

                _addCommand.flag = item.FlagMap.Data;

                _addCommand.priority = (int)item.Priority;

                ObjectQueryInfo objectQueryInfo = new ObjectQueryInfo();

                if (item.QueryInfo["query-info"] != null)
                {
                    objectQueryInfo.queryInfo = ProtobufHelper.GetQueryInfoObj(item.QueryInfo["query-info"] as Hashtable);
                }

                _addCommand.objectQueryInfo = objectQueryInfo;

                short           removeCallbackId      = -1;
                short           updateCallbackId      = -1;
                EventDataFilter itemUpdateDataFilter  = EventDataFilter.None;
                EventDataFilter itemRemovedDataFilter = EventDataFilter.None;

                if (item.CacheItemRemovedCallback != null)
                {
                    itemRemovedDataFilter = item.ItemRemovedCallabackDataFilter;
                    short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemRemovedCallback, EventType.ItemRemoved, itemRemovedDataFilter);
                    removeCallbackId = callabackIds[1];
                }


                if (item.CacheItemUpdatedCallback != null)
                {
                    itemUpdateDataFilter = item.ItemUpdatedCallabackDataFilter;
                    short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemUpdatedCallback, EventType.ItemUpdated, itemUpdateDataFilter);
                    updateCallbackId = callabackIds[0];
                }


                _addCommand.removeCallbackId = removeCallbackId;
                _addCommand.updateCallbackId = updateCallbackId;
                _addCommand.updateDataFilter = (short)itemUpdateDataFilter;
                _addCommand.removeDataFilter = (short)itemRemovedDataFilter;

                _bulkAddCommand.addCommand.Add(_addCommand);
            }
        }
Esempio n. 3
0
        public BulkAddCommand(string[] keys, CacheItem[] items, short onDsItemsAddedCallback,
                              Alachisoft.NCache.Web.Caching.Cache parent, string providerName, string cacheId, int methodOverload,
                              string clientId, short updateCallbackId, short removedCallbackId, EventDataFilter updateCallbackFilter,
                              EventDataFilter removeCallabackFilter, bool returnVersions,
                              CallbackType callbackType = Runtime.Events.CallbackType.PushBasedNotification)
        {
            base.name       = "BulkAddCommand";
            _parent         = parent;
            _methodOverload = methodOverload;
            _bulkAddCommand = new Alachisoft.NCache.Common.Protobuf.BulkAddCommand();
            _bulkAddCommand.datasourceItemAddedCallbackId = onDsItemsAddedCallback;
            _bulkAddCommand.providerName   = providerName;
            _bulkAddCommand.returnVersions = returnVersions;
            _bulkAddCommand.requestId      = base.RequestId;
            base.BulkKeys = keys;

            for (int i = 0; i < keys.Length; i++)
            {
                CacheItem item = items[i];

                _addCommand     = new Alachisoft.NCache.Common.Protobuf.AddCommand();
                _addCommand.key = keys[i];

                Alachisoft.NCache.Caching.UserBinaryObject ubObject =
                    Alachisoft.NCache.Caching.UserBinaryObject.CreateUserBinaryObject((byte[])item.Value);
                _addCommand.data.AddRange(ubObject.DataList);

                if (item.AbsoluteExpiration.Equals(Caching.Cache.DefaultAbsolute.ToUniversalTime()))
                {
                    _addCommand.absExpiration = 1;
                }
                else if (item.AbsoluteExpiration.Equals(Caching.Cache.DefaultAbsoluteLonger.ToUniversalTime()))
                {
                    _addCommand.absExpiration = 2;
                }
                else if (item.AbsoluteExpiration != Caching.Cache.NoAbsoluteExpiration)
                {
                    _addCommand.absExpiration = item.AbsoluteExpiration.Ticks;
                }

                if (item.SlidingExpiration.Equals(Caching.Cache.DefaultSliding))
                {
                    _addCommand.sldExpiration = 1;
                }
                else if (item.SlidingExpiration.Equals(Caching.Cache.DefaultSlidingLonger))
                {
                    _addCommand.sldExpiration = 2;
                }
                else if (item.SlidingExpiration != Caching.Cache.NoSlidingExpiration)
                {
                    _addCommand.sldExpiration = item.SlidingExpiration.Ticks;
                }

                _addCommand.flag       = item.FlagMap.Data;
                _addCommand.group      = item.Group;
                _addCommand.subGroup   = item.SubGroup;
                _addCommand.isResync   = item.IsResyncExpiredItems;
                _addCommand.priority   = (int)item.Priority;
                _addCommand.dependency = item.Dependency == null
                    ? null
                    : Alachisoft.NCache.Common.Util.DependencyHelper.GetProtoBufDependency(item.Dependency);

                _addCommand.clientID     = clientId;
                _addCommand.CallbackType = CallbackType(callbackType);


                ObjectQueryInfo objectQueryInfo = new ObjectQueryInfo();

                if (item.QueryInfo["query-info"] != null)
                {
                    objectQueryInfo.queryInfo =
                        ProtobufHelper.GetQueryInfoObj(item.QueryInfo["query-info"] as Hashtable);
                }

                if (item.QueryInfo["tag-info"] != null)
                {
                    objectQueryInfo.tagInfo = ProtobufHelper.GetTagInfoObj(item.QueryInfo["tag-info"] as Hashtable);
                }

                if (item.QueryInfo["named-tag-info"] != null)
                {
                    objectQueryInfo.namedTagInfo =
                        ProtobufHelper.GetNamedTagInfoObj(item.QueryInfo["named-tag-info"] as Hashtable, true);
                }


                _addCommand.objectQueryInfo = objectQueryInfo;


                EventDataFilter itemUpdateDataFilter  = updateCallbackFilter;
                EventDataFilter itemRemovedDataFilter = removeCallabackFilter;


                if (item.CacheItemRemovedCallback != null)
                {
                    itemRemovedDataFilter = item.ItemRemovedCallabackDataFilter;
                    short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemRemovedCallback,
                                                                                       EventType.ItemRemoved, itemRemovedDataFilter);
                    removedCallbackId = callabackIds[1];
                }
                else if (item.ItemRemoveCallback != null)
                {
                    removedCallbackId     = _parent.GetCallbackId(item.ItemRemoveCallback);
                    itemRemovedDataFilter = EventDataFilter.DataWithMetadata;
                }


                if (item.CacheItemUpdatedCallback != null)
                {
                    itemUpdateDataFilter = item.ItemUpdatedCallabackDataFilter;
                    short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemUpdatedCallback,
                                                                                       EventType.ItemUpdated, itemUpdateDataFilter);
                    updateCallbackId = callabackIds[0];
                }
                else if (item.ItemUpdateCallback != null)
                {
                    updateCallbackId     = _parent.GetCallbackId(item.ItemUpdateCallback);
                    itemUpdateDataFilter = EventDataFilter.None;
                }


                _addCommand.removeCallbackId = removedCallbackId;
                _addCommand.updateCallbackId = updateCallbackId;
                _addCommand.updateDataFilter = (short)itemUpdateDataFilter;
                _addCommand.removeDataFilter = (short)itemRemovedDataFilter;

                _addCommand.resyncProviderName = item.ResyncProviderName;

                if (item.SyncDependency != null)
                {
                    _addCommand.syncDependency         = new Alachisoft.NCache.Common.Protobuf.SyncDependency();
                    _addCommand.syncDependency.key     = item.SyncDependency.Key;
                    _addCommand.syncDependency.cacheId = item.SyncDependency.CacheId;
                    _addCommand.syncDependency.server  = item.SyncDependency.Server;
                    _addCommand.syncDependency.port    = item.SyncDependency.Port;
                }

                _bulkAddCommand.addCommand.Add(_addCommand);
            }
        }
Esempio n. 4
0
        protected CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager, string cacheId)
        {
            CommandInfo cmdInfo     = new CommandInfo();
            int         packageSize = 0;
            int         index       = 0;
            string      version     = string.Empty;
            NCache      nCache      = clientManager.CmdExecuter as NCache;

            Caching.Cache cache = nCache.Cache;
            Hashtable     queryInfoHashtable = null;
            Hashtable     tagHashtable       = null;
            Hashtable     namedTagHashtable  = null;

            switch (command.type)
            {
            case Alachisoft.NCache.Common.Protobuf.Command.Type.ADD_BULK:
                Alachisoft.NCache.Common.Protobuf.BulkAddCommand bulkAddCommand = command.bulkAddCommand;

                packageSize = bulkAddCommand.addCommand.Count;

                cmdInfo.Keys    = new string[packageSize];
                cmdInfo.Entries = new CacheEntry[packageSize];
                cmdInfo.OnDsItemsAddedCallback = (short)bulkAddCommand.datasourceItemAddedCallbackId;
                cmdInfo.ProviderName           = bulkAddCommand.providerName.Length == 0 ? null : bulkAddCommand.providerName;
                cmdInfo.RequestId         = bulkAddCommand.requestId.ToString();
                cmdInfo.ClientLastViewId  = command.clientLastViewId;
                cmdInfo.IntendedRecipient = command.intendedRecipient;

                cmdInfo.returnVersion = bulkAddCommand.returnVersions;

                foreach (Alachisoft.NCache.Common.Protobuf.AddCommand addCommand in bulkAddCommand.addCommand)
                {
                    cmdInfo.Keys[index] = addCommand.key;
                    cmdInfo.ClientID    = addCommand.clientID;
                    if (index == 0)
                    {
                        cmdInfo.Flag = new BitSet((byte)addCommand.flag);
                    }
                    object value = cache.SocketServerDataService.GetCacheData(addCommand.data.ToArray(), cmdInfo.Flag);
                    cmdInfo.Entries[index] = new CacheEntry(value, Alachisoft.NCache.Caching.Util.ProtobufHelper.GetExpirationHintObj(cache.Configuration.ExpirationPolicy, addCommand.dependency, addCommand.absExpiration, addCommand.sldExpiration, addCommand.isResync, serailizationContext), new PriorityEvictionHint((CacheItemPriority)addCommand.priority));
                    CallbackEntry cbEntry = null;
                    if ((short)addCommand.updateCallbackId != -1 || (short)addCommand.removeCallbackId != -1 || cmdInfo.OnDsItemsAddedCallback != -1)
                    {
                        cbEntry = new CallbackEntry(!string.IsNullOrEmpty(cmdInfo.ClientID) ? cmdInfo.ClientID : clientManager.ClientID,
                                                    Convert.ToInt32(cmdInfo.RequestId),
                                                    value,
                                                    (short)addCommand.removeCallbackId,
                                                    (short)addCommand.updateCallbackId,
                                                    (short)(cmdInfo.RequestId.Equals("-1") ? -1 : 0),
                                                    cmdInfo.OnDsItemsAddedCallback,
                                                    new BitSet((byte)addCommand.flag),
                                                    (EventDataFilter)(addCommand.updateDataFilter != -1 ? (int)addCommand.updateDataFilter : (int)EventDataFilter.None),
                                                    (EventDataFilter)(addCommand.removeDataFilter != -1 ? (int)addCommand.removeDataFilter : (int)EventDataFilter.DataWithMetadata)
                                                    );
                        cmdInfo.Entries[index].Value = cbEntry.Clone();
                    }

                    cmdInfo.onUpdateCallbackId = (short)addCommand.updateCallbackId;
                    if (addCommand.group != null)
                    {
                        cmdInfo.Group = addCommand.group.Length == 0 ? null : addCommand.group;
                    }
                    if (addCommand.subGroup != null)
                    {
                        cmdInfo.SubGroup = addCommand.subGroup.Length == 0 ? null : addCommand.subGroup;
                    }

                    if (!String.IsNullOrEmpty(cmdInfo.Group))
                    {
                        cmdInfo.Entries[index].GroupInfo = new GroupInfo(cmdInfo.Group, cmdInfo.SubGroup);
                    }

                    version = command.version;

                    if (string.IsNullOrEmpty(version))
                    {
                        queryInfoHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(addCommand.queryInfo);
                        tagHashtable       = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromTagInfoObj(addCommand.tagInfo);
                        if (clientManager.IsDotNetClient)
                        {
                            namedTagHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromNamedTagInfoObjFromDotNet(addCommand.namedTagInfo);
                        }
                        else
                        {
                            namedTagHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromNamedTagInfoObjFromJava(addCommand.namedTagInfo);
                        }
                    }
                    else
                    {
                        ObjectQueryInfo objectQueryInfo = addCommand.objectQueryInfo;

                        queryInfoHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(objectQueryInfo.queryInfo);
                        tagHashtable       = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromTagInfoObj(objectQueryInfo.tagInfo);
                        if (clientManager.IsDotNetClient)
                        {
                            namedTagHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromNamedTagInfoObjFromDotNet(objectQueryInfo.namedTagInfo);
                        }
                        else
                        {
                            namedTagHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromNamedTagInfoObjFromJava(objectQueryInfo.namedTagInfo);
                        }
                    }
                    if (queryInfoHashtable != null)
                    {
                        if (cmdInfo.Entries[index].QueryInfo == null)
                        {
                            cmdInfo.Entries[index].QueryInfo = new Hashtable();
                        }
                        cmdInfo.Entries[index].QueryInfo.Add("query-info", queryInfoHashtable);
                    }

                    if (tagHashtable != null)
                    {
                        if (cmdInfo.Entries[index].QueryInfo == null)
                        {
                            cmdInfo.Entries[index].QueryInfo = new Hashtable();
                        }
                        cmdInfo.Entries[index].QueryInfo.Add("tag-info", tagHashtable);
                    }

                    if (namedTagHashtable != null)
                    {
                        if (cmdInfo.Entries[index].QueryInfo == null)
                        {
                            cmdInfo.Entries[index].QueryInfo = new Hashtable();
                        }
                        cmdInfo.Entries[index].QueryInfo.Add("named-tag-info", namedTagHashtable);
                    }

                    cmdInfo.Entries[index].SyncDependency = base.GetCacheSyncDependencyObj(addCommand.syncDependency);
                    index++;
                }

                break;

            case Alachisoft.NCache.Common.Protobuf.Command.Type.INSERT_BULK:
                Alachisoft.NCache.Common.Protobuf.BulkInsertCommand bulkInsertCommand = command.bulkInsertCommand;

                packageSize = bulkInsertCommand.insertCommand.Count;

                cmdInfo.Keys    = new string[packageSize];
                cmdInfo.Entries = new CacheEntry[packageSize];

                cmdInfo.OnDsItemsAddedCallback = (short)bulkInsertCommand.datasourceUpdatedCallbackId;
                cmdInfo.ProviderName           = bulkInsertCommand.providerName.Length == 0 ? null : bulkInsertCommand.providerName;
                cmdInfo.RequestId         = bulkInsertCommand.requestId.ToString();
                cmdInfo.ClientLastViewId  = command.clientLastViewId;
                cmdInfo.IntendedRecipient = command.intendedRecipient;

                cmdInfo.returnVersion = bulkInsertCommand.returnVersions;

                foreach (Alachisoft.NCache.Common.Protobuf.InsertCommand insertCommand in bulkInsertCommand.insertCommand)
                {
                    cmdInfo.Keys[index] = insertCommand.key;
                    cmdInfo.ClientID    = insertCommand.clientID;
                    if (index == 0)
                    {
                        cmdInfo.Flag = new BitSet((byte)insertCommand.flag);
                    }
                    object value = cache.SocketServerDataService.GetCacheData(insertCommand.data.ToArray(), cmdInfo.Flag);
                    cmdInfo.Entries[index] = new CacheEntry(value, Alachisoft.NCache.Caching.Util.ProtobufHelper.GetExpirationHintObj(cache.Configuration.ExpirationPolicy, insertCommand.dependency, insertCommand.absExpiration, insertCommand.sldExpiration, insertCommand.isResync, serailizationContext), new PriorityEvictionHint((CacheItemPriority)insertCommand.priority));


                    CallbackEntry cbEntry = null;
                    if (insertCommand.updateCallbackId != -1 || insertCommand.removeCallbackId != -1 || cmdInfo.OnDsItemsAddedCallback != -1)
                    {
                        cbEntry = new CallbackEntry(!string.IsNullOrEmpty(cmdInfo.ClientID) ? cmdInfo.ClientID : clientManager.ClientID,
                                                    Convert.ToInt32(cmdInfo.RequestId),
                                                    value,
                                                    (short)insertCommand.removeCallbackId,
                                                    (short)insertCommand.updateCallbackId,
                                                    (short)(cmdInfo.RequestId.Equals("-1") ? -1 : 0),
                                                    cmdInfo.OnDsItemsAddedCallback,
                                                    new BitSet((byte)insertCommand.flag),
                                                    (EventDataFilter)(insertCommand.updateDataFilter != -1 ? (int)insertCommand.updateDataFilter : (int)EventDataFilter.None),
                                                    (EventDataFilter)(insertCommand.removeDataFilter != -1 ? (int)insertCommand.removeDataFilter : (int)EventDataFilter.None)
                                                    );
                        cmdInfo.Entries[index].Value = cbEntry.Clone();
                    }

                    cmdInfo.onUpdateCallbackId = (short)insertCommand.updateCallbackId;

                    if (insertCommand.group != null)
                    {
                        cmdInfo.Group = insertCommand.group.Length == 0 ? null : insertCommand.group;
                    }
                    if (insertCommand.subGroup != null)
                    {
                        cmdInfo.SubGroup = insertCommand.subGroup.Length == 0 ? null : insertCommand.subGroup;
                    }
                    if (!String.IsNullOrEmpty(cmdInfo.Group))
                    {
                        cmdInfo.Entries[index].GroupInfo = new GroupInfo(cmdInfo.Group, cmdInfo.SubGroup);
                    }

                    version = command.version;

                    if (string.IsNullOrEmpty(version))
                    {
                        queryInfoHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(insertCommand.queryInfo);
                        tagHashtable       = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromTagInfoObj(insertCommand.tagInfo);
                        if (clientManager.IsDotNetClient)
                        {
                            namedTagHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromNamedTagInfoObjFromDotNet(insertCommand.namedTagInfo);
                        }
                        else
                        {
                            namedTagHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromNamedTagInfoObjFromJava(insertCommand.namedTagInfo);
                        }
                    }
                    else
                    {
                        ObjectQueryInfo objectQueryInfo = insertCommand.objectQueryInfo;

                        queryInfoHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(objectQueryInfo.queryInfo);

                        tagHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromTagInfoObj(objectQueryInfo.tagInfo);

                        if (clientManager.IsDotNetClient)
                        {
                            namedTagHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromNamedTagInfoObjFromDotNet(objectQueryInfo.namedTagInfo);
                        }
                        else
                        {
                            namedTagHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromNamedTagInfoObjFromJava(objectQueryInfo.namedTagInfo);
                        }
                    }

                    if (queryInfoHashtable != null)
                    {
                        if (cmdInfo.Entries[index].QueryInfo == null)
                        {
                            cmdInfo.Entries[index].QueryInfo = new Hashtable();
                        }
                        cmdInfo.Entries[index].QueryInfo.Add("query-info", queryInfoHashtable);
                    }

                    if (tagHashtable != null)
                    {
                        if (cmdInfo.Entries[index].QueryInfo == null)
                        {
                            cmdInfo.Entries[index].QueryInfo = new Hashtable();
                        }
                        cmdInfo.Entries[index].QueryInfo.Add("tag-info", tagHashtable);
                    }

                    if (namedTagHashtable != null)
                    {
                        if (cmdInfo.Entries[index].QueryInfo == null)
                        {
                            cmdInfo.Entries[index].QueryInfo = new Hashtable();
                        }
                        cmdInfo.Entries[index].QueryInfo.Add("named-tag-info", namedTagHashtable);
                    }

                    cmdInfo.Entries[index].SyncDependency = base.GetCacheSyncDependencyObj(insertCommand.syncDependency);

                    index++;
                }

                break;
            }

            return(cmdInfo);
        }
        //PROTOBUF
        protected CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager, string cacheId)
        {
            CommandInfo cmdInfo            = new CommandInfo();
            int         packageSize        = 0;
            int         index              = 0;
            string      version            = string.Empty;
            Hashtable   queryInfoHashtable = null;

            switch (command.type)
            {
            case Alachisoft.NCache.Common.Protobuf.Command.Type.ADD_BULK:
                Alachisoft.NCache.Common.Protobuf.BulkAddCommand bulkAddCommand = command.bulkAddCommand;

                packageSize = bulkAddCommand.addCommand.Count;

                cmdInfo.Keys    = new string[packageSize];
                cmdInfo.Entries = new CacheEntry[packageSize];

                cmdInfo.RequestId         = bulkAddCommand.requestId.ToString();
                cmdInfo.ClientLastViewId  = command.clientLastViewId;
                cmdInfo.IntendedRecipient = command.intendedRecipient;
                foreach (Alachisoft.NCache.Common.Protobuf.AddCommand addCommand in bulkAddCommand.addCommand)
                {
                    cmdInfo.Keys[index] = addCommand.key;

                    cmdInfo.Entries[index] = new CacheEntry(UserBinaryObject.CreateUserBinaryObject(addCommand.data.ToArray()), Alachisoft.NCache.Caching.Util.ProtobufHelper.GetExpirationHintObj(addCommand.absExpiration, addCommand.sldExpiration, serailizationContext), new PriorityEvictionHint((CacheItemPriority)addCommand.priority));
                    if (index == 0)
                    {
                        cmdInfo.Flag = new BitSet((byte)addCommand.flag);
                    }

                    CallbackEntry cbEntry = null;
                    if ((short)addCommand.updateCallbackId != -1 || (short)addCommand.removeCallbackId != -1)
                    {
                        cbEntry = new CallbackEntry(ClientId,
                                                    Convert.ToInt32(cmdInfo.RequestId),
                                                    UserBinaryObject.CreateUserBinaryObject(addCommand.data.ToArray()),
                                                    (short)addCommand.removeCallbackId,
                                                    (short)addCommand.updateCallbackId,
                                                    new BitSet((byte)addCommand.flag),
                                                    (EventDataFilter)(addCommand.updateDataFilter != -1 ? (int)addCommand.updateDataFilter : (int)EventDataFilter.None),
                                                    (EventDataFilter)(addCommand.removeDataFilter != -1 ? (int)addCommand.removeDataFilter : (int)EventDataFilter.DataWithMetadata)
                                                    );
                        cmdInfo.Entries[index].Value = cbEntry.Clone();
                    }



                    version = command.version;

                    if (string.IsNullOrEmpty(version))
                    {
                        queryInfoHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(addCommand.queryInfo);
                    }
                    else
                    {
                        ObjectQueryInfo objectQueryInfo;

                        objectQueryInfo = addCommand.objectQueryInfo;

                        queryInfoHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(objectQueryInfo.queryInfo);
                    }

                    if (queryInfoHashtable != null)
                    {
                        if (cmdInfo.Entries[index].QueryInfo == null)
                        {
                            cmdInfo.Entries[index].QueryInfo = new Hashtable();
                        }
                        cmdInfo.Entries[index].QueryInfo.Add("query-info", queryInfoHashtable);
                    }



                    index++;
                }

                break;

            case Alachisoft.NCache.Common.Protobuf.Command.Type.INSERT_BULK:
                Alachisoft.NCache.Common.Protobuf.BulkInsertCommand bulkInsertCommand = command.bulkInsertCommand;

                packageSize = bulkInsertCommand.insertCommand.Count;

                cmdInfo.Keys              = new string[packageSize];
                cmdInfo.Entries           = new CacheEntry[packageSize];
                cmdInfo.RequestId         = bulkInsertCommand.requestId.ToString();
                cmdInfo.ClientLastViewId  = command.clientLastViewId;
                cmdInfo.IntendedRecipient = command.intendedRecipient;
                foreach (Alachisoft.NCache.Common.Protobuf.InsertCommand insertCommand in bulkInsertCommand.insertCommand)
                {
                    cmdInfo.Keys[index]    = insertCommand.key;
                    cmdInfo.Entries[index] = new CacheEntry(UserBinaryObject.CreateUserBinaryObject(insertCommand.data.ToArray()), Alachisoft.NCache.Caching.Util.ProtobufHelper.GetExpirationHintObj(insertCommand.absExpiration, insertCommand.sldExpiration, serailizationContext), new PriorityEvictionHint((CacheItemPriority)insertCommand.priority));
                    if (index == 0)
                    {
                        cmdInfo.Flag = new BitSet((byte)insertCommand.flag);
                    }

                    CallbackEntry cbEntry = null;
                    if (insertCommand.updateCallbackId != -1 || insertCommand.removeCallbackId != -1)
                    {
                        cbEntry = new CallbackEntry(ClientId,
                                                    Convert.ToInt32(cmdInfo.RequestId),
                                                    UserBinaryObject.CreateUserBinaryObject(insertCommand.data.ToArray()),
                                                    (short)insertCommand.removeCallbackId,
                                                    (short)insertCommand.updateCallbackId,
                                                    new BitSet((byte)insertCommand.flag),
                                                    (EventDataFilter)(insertCommand.updateDataFilter != -1 ? (int)insertCommand.updateDataFilter : (int)EventDataFilter.None),
                                                    (EventDataFilter)(insertCommand.removeDataFilter != -1 ? (int)insertCommand.removeDataFilter : (int)EventDataFilter.None)
                                                    );
                        cmdInfo.Entries[index].Value = cbEntry.Clone();
                    }


                    version = command.version;

                    if (string.IsNullOrEmpty(version))
                    {
                        queryInfoHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(insertCommand.queryInfo);
                    }
                    else
                    {
                        ObjectQueryInfo objectQueryInfo;

                        objectQueryInfo    = insertCommand.objectQueryInfo;
                        queryInfoHashtable = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetHashtableFromQueryInfoObj(objectQueryInfo.queryInfo);
                    }

                    if (queryInfoHashtable != null)
                    {
                        if (cmdInfo.Entries[index].QueryInfo == null)
                        {
                            cmdInfo.Entries[index].QueryInfo = new Hashtable();
                        }
                        cmdInfo.Entries[index].QueryInfo.Add("query-info", queryInfoHashtable);
                    }

                    index++;
                }

                break;
            }

            return(cmdInfo);
        }
Esempio n. 6
0
        public BulkAddCommand(string[] keys, CacheItem[] items, Cache parent, string cacheId)
        {
            base.name = "BulkAddCommand";
            _parent = parent;

            _bulkAddCommand = new Alachisoft.NCache.Common.Protobuf.BulkAddCommand();
            _bulkAddCommand.requestId = base.RequestId;
            base.BulkKeys = keys;

            for (int i = 0; i < keys.Length; i++)
            {
                CacheItem item = items[i];

                _addCommand = new Alachisoft.NCache.Common.Protobuf.AddCommand();
                _addCommand.key = keys[i];

                Alachisoft.NCache.Caching.UserBinaryObject ubObject = Alachisoft.NCache.Caching.UserBinaryObject.CreateUserBinaryObject((byte[])item.Value);
                _addCommand.data.AddRange(ubObject.DataList);

                if (item.AbsoluteExpiration != Cache.NoAbsoluteExpiration)
                    _addCommand.absExpiration = item.AbsoluteExpiration.Ticks;

                if (item.SlidingExpiration != Cache.NoSlidingExpiration)
                    _addCommand.sldExpiration = item.SlidingExpiration.Ticks;

                _addCommand.flag = item.FlagMap.Data;

                _addCommand.priority = (int)item.Priority;

                // Updated in Version 4.2 [Dated 20-Nov-2013; Author: Sami]
                ObjectQueryInfo objectQueryInfo = new ObjectQueryInfo();

                if (item.QueryInfo["query-info"] != null)
                    objectQueryInfo.queryInfo = ProtobufHelper.GetQueryInfoObj(item.QueryInfo["query-info"] as Hashtable);

                _addCommand.objectQueryInfo = objectQueryInfo;

                short removeCallbackId = -1;
                short updateCallbackId = -1;
                EventDataFilter itemUpdateDataFilter = EventDataFilter.None;
                EventDataFilter itemRemovedDataFilter = EventDataFilter.None;

                if (item.CacheItemRemovedCallback != null)
                {
                    itemRemovedDataFilter = item.ItemRemovedCallabackDataFilter;
                    short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemRemovedCallback, EventType.ItemRemoved, itemRemovedDataFilter);
                    removeCallbackId = callabackIds[1];
                }

                if (item.CacheItemUpdatedCallback != null)
                {
                    itemUpdateDataFilter = item.ItemUpdatedCallabackDataFilter;
                    short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemUpdatedCallback, EventType.ItemUpdated, itemUpdateDataFilter);
                    updateCallbackId = callabackIds[0];
                }

                _addCommand.removeCallbackId = removeCallbackId;
                _addCommand.updateCallbackId = updateCallbackId;
                _addCommand.updateDataFilter = (short)itemUpdateDataFilter;
                _addCommand.removeDataFilter = (short)itemRemovedDataFilter;

                _bulkAddCommand.addCommand.Add(_addCommand);
            }
        }
        protected CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager, string cacheId)
        {
            CommandInfo cmdInfo     = new CommandInfo();
            int         packageSize = 0;
            int         index       = 0;
            string      version     = string.Empty;
            NCache      nCache      = clientManager.CmdExecuter as NCache;

            Caching.Cache cache = nCache.Cache;
            Hashtable     queryInfoHashtable = null;
            Hashtable     tagHashtable       = null;
            Hashtable     namedTagHashtable  = null;

            try
            {
                switch (command.type)
                {
                case Alachisoft.NCache.Common.Protobuf.Command.Type.ADD_BULK:
                    Alachisoft.NCache.Common.Protobuf.BulkAddCommand bulkAddCommand = command.bulkAddCommand;
                    packageSize = bulkAddCommand.addCommand.Count;

                    cmdInfo.Keys    = new string[packageSize];
                    cmdInfo.Entries = new CacheEntry[packageSize];
                    cmdInfo.OnDsItemsAddedCallback = (short)bulkAddCommand.datasourceItemAddedCallbackId;
                    cmdInfo.ProviderName           = bulkAddCommand.providerName.Length == 0 ? null : bulkAddCommand.providerName;
                    cmdInfo.RequestId         = bulkAddCommand.requestId;
                    cmdInfo.ClientLastViewId  = command.clientLastViewId;
                    cmdInfo.IntendedRecipient = command.intendedRecipient;

                    cmdInfo.returnVersion = bulkAddCommand.returnVersions;

                    foreach (Alachisoft.NCache.Common.Protobuf.AddCommand addCommand in bulkAddCommand.addCommand)
                    {
                        cmdInfo.Keys[index] = addCommand.key;
                        cmdInfo.ClientID    = addCommand.clientID;

                        BitSet flag = BitSet.CreateAndMarkInUse(clientManager.CacheFakePool, NCModulesConstants.SocketServer);
                        flag.Data = ((byte)addCommand.flag);
                        if (index == 0)
                        {
                            cmdInfo.Flag = flag;
                        }

                        object value = cache.SocketServerDataService.GetCacheData(addCommand.data.ToArray(), cmdInfo.Flag);

                        cmdInfo.Entries[index]            = CacheEntry.CreateCacheEntry(clientManager.CacheTransactionalPool, value, Alachisoft.NCache.Caching.Util.ProtobufHelper.GetExpirationHintObj(clientManager.CacheTransactionalPool, null, addCommand.absExpiration, addCommand.sldExpiration, addCommand.isResync, serailizationContext), PriorityEvictionHint.Create(clientManager.CacheTransactionalPool, (CacheItemPriority)addCommand.priority));
                        cmdInfo.Entries[index].Flag.Data |= flag.Data;

                        Notifications notification = null;
                        if ((short)addCommand.updateCallbackId != -1 || (short)addCommand.removeCallbackId != -1 || cmdInfo.OnDsItemsAddedCallback != -1)
                        {
                            notification = new Notifications(!string.IsNullOrEmpty(cmdInfo.ClientID) ? cmdInfo.ClientID : clientManager.ClientID,
                                                             Convert.ToInt32(cmdInfo.RequestId),
                                                             (short)addCommand.removeCallbackId,
                                                             (short)addCommand.updateCallbackId,
                                                             (short)(cmdInfo.RequestId == -1 ? -1 : 0),
                                                             cmdInfo.OnDsItemsAddedCallback,
                                                             (EventDataFilter)(addCommand.updateDataFilter != -1 ? (int)addCommand.updateDataFilter : (int)EventDataFilter.None),
                                                             (EventDataFilter)(addCommand.removeDataFilter != -1 ? (int)addCommand.removeDataFilter : (int)EventDataFilter.None)
                                                             );
                            cmdInfo.Entries[index].Notifications = notification;
                        }

                        cmdInfo.onUpdateCallbackId = (short)addCommand.updateCallbackId;
                        if (!String.IsNullOrEmpty(cmdInfo.Group))
                        {
                            cmdInfo.Entries[index].GroupInfo = new GroupInfo(cmdInfo.Group, cmdInfo.SubGroup, cmdInfo.type);
                        }

                        version = command.version;
                        if (queryInfoHashtable != null)
                        {
                            if (cmdInfo.Entries[index].QueryInfo == null)
                            {
                                cmdInfo.Entries[index].QueryInfo = new Hashtable();
                            }
                            cmdInfo.Entries[index].QueryInfo.Add("query-info", queryInfoHashtable);
                        }
                        cmdInfo.Entries[index].MarkInUse(NCModulesConstants.SocketServer);
                        index++;

                        if (addCommand?.PoolManager != null)
                        {
                            addCommand.PoolManager.GetProtobufAddCommandPool()?.Return(addCommand);
                        }
                    }

                    break;

                case Alachisoft.NCache.Common.Protobuf.Command.Type.INSERT_BULK:
                    Alachisoft.NCache.Common.Protobuf.BulkInsertCommand bulkInsertCommand = command.bulkInsertCommand;

                    packageSize = bulkInsertCommand.insertCommand.Count;

                    cmdInfo.Keys    = new string[packageSize];
                    cmdInfo.Entries = new CacheEntry[packageSize];

                    cmdInfo.OnDsItemsAddedCallback = (short)bulkInsertCommand.datasourceUpdatedCallbackId;
                    cmdInfo.ProviderName           = bulkInsertCommand.providerName.Length == 0 ? null : bulkInsertCommand.providerName;
                    cmdInfo.RequestId         = bulkInsertCommand.requestId;
                    cmdInfo.ClientLastViewId  = command.clientLastViewId;
                    cmdInfo.IntendedRecipient = command.intendedRecipient;

                    cmdInfo.returnVersion = bulkInsertCommand.returnVersions;

                    foreach (Alachisoft.NCache.Common.Protobuf.InsertCommand insertCommand in bulkInsertCommand.insertCommand)
                    {
                        cmdInfo.Keys[index] = insertCommand.key;
                        cmdInfo.ClientID    = insertCommand.clientID;
                        BitSet flag = BitSet.CreateAndMarkInUse(clientManager.CacheFakePool, NCModulesConstants.SocketServer);
                        flag.Data = ((byte)insertCommand.flag);
                        if (index == 0)
                        {
                            cmdInfo.Flag = flag;
                        }
                        object value = cache.SocketServerDataService.GetCacheData(insertCommand.data.ToArray(), cmdInfo.Flag);

                        cmdInfo.Entries[index]            = CacheEntry.CreateCacheEntry(clientManager.CacheTransactionalPool, value, Alachisoft.NCache.Caching.Util.ProtobufHelper.GetExpirationHintObj(clientManager.CacheTransactionalPool, null, insertCommand.absExpiration, insertCommand.sldExpiration, insertCommand.isResync, serailizationContext), PriorityEvictionHint.Create(clientManager.CacheTransactionalPool, (CacheItemPriority)insertCommand.priority));
                        cmdInfo.Entries[index].Flag.Data |= flag.Data;

                        Notifications notification = null;
                        if (insertCommand.updateCallbackId != -1 || insertCommand.removeCallbackId != -1 || cmdInfo.OnDsItemsAddedCallback != -1)
                        {
                            notification = new Notifications(!string.IsNullOrEmpty(cmdInfo.ClientID) ? cmdInfo.ClientID : clientManager.ClientID,
                                                             Convert.ToInt32(cmdInfo.RequestId),
                                                             (short)insertCommand.removeCallbackId,
                                                             (short)insertCommand.updateCallbackId,
                                                             (short)(cmdInfo.RequestId == -1 ? -1 : 0),
                                                             cmdInfo.OnDsItemsAddedCallback,
                                                             (EventDataFilter)(insertCommand.updateDataFilter != -1 ? (int)insertCommand.updateDataFilter : (int)EventDataFilter.None),
                                                             (EventDataFilter)(insertCommand.removeDataFilter != -1 ? (int)insertCommand.removeDataFilter : (int)EventDataFilter.None)
                                                             );
                            cmdInfo.Entries[index].Notifications = notification;
                        }

                        cmdInfo.onUpdateCallbackId = (short)insertCommand.updateCallbackId;

                        if (!String.IsNullOrEmpty(cmdInfo.Group))
                        {
                            cmdInfo.Entries[index].GroupInfo = new GroupInfo(cmdInfo.Group, cmdInfo.SubGroup, cmdInfo.type);
                        }



                        version = command.version;

                        if (queryInfoHashtable != null)
                        {
                            if (cmdInfo.Entries[index].QueryInfo == null)
                            {
                                cmdInfo.Entries[index].QueryInfo = new Hashtable();
                            }
                            cmdInfo.Entries[index].QueryInfo.Add("query-info", queryInfoHashtable);
                        }

                        if (tagHashtable != null)
                        {
                            if (cmdInfo.Entries[index].QueryInfo == null)
                            {
                                cmdInfo.Entries[index].QueryInfo = new Hashtable();
                            }
                            cmdInfo.Entries[index].QueryInfo.Add("tag-info", tagHashtable);
                        }

                        cmdInfo.Entries[index].MarkInUse(NCModulesConstants.SocketServer);
                        index++;

                        if (insertCommand?.PoolManager != null)
                        {
                            insertCommand.PoolManager.GetProtobufInsertCommandPool()?.Return(insertCommand);
                        }
                    }

                    break;
                }
            }
            finally
            {
            }
            return(cmdInfo);
        }