コード例 #1
0
        //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);
        }
コード例 #2
0
ファイル: BulkInsertCommand.cs プロジェクト: yaobos/NCache
        public BulkInsertCommand(string[] keys, CacheItem[] items, Cache parent, string cacheId)
        {
            base.name                    = "BulkInsertCommand";
            _parent                      = parent;
            base.BulkKeys                = keys;
            _bulkInsertCommand           = new Alachisoft.NCache.Common.Protobuf.BulkInsertCommand();
            _bulkInsertCommand.requestId = base.RequestId;

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

                _insertCommand     = new Alachisoft.NCache.Common.Protobuf.InsertCommand();
                _insertCommand.key = keys[i];

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

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

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

                _insertCommand.flag     = item.FlagMap.Data;
                _insertCommand.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);
                }

                _insertCommand.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];
                }


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

                _bulkInsertCommand.insertCommand.Add(_insertCommand);
            }
        }
コード例 #3
0
        public BulkInsertCommand(string[] keys, CacheItem[] items,  Cache parent, string cacheId)
        {
            base.name = "BulkInsertCommand";
            _parent = parent;
            base.BulkKeys = keys;
            _bulkInsertCommand = new Alachisoft.NCache.Common.Protobuf.BulkInsertCommand();
            _bulkInsertCommand.requestId = base.RequestId;

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

                _insertCommand = new Alachisoft.NCache.Common.Protobuf.InsertCommand();
                _insertCommand.key = keys[i];

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

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

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

                _insertCommand.flag = item.FlagMap.Data;
               _insertCommand.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);

                _insertCommand.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];
                }

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

                _bulkInsertCommand.insertCommand.Add(_insertCommand);
            }
        }
コード例 #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);
        }
コード例 #5
0
        //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);
        }
コード例 #6
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;

            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);
        }
コード例 #7
0
        public BulkInsertCommand(string[] keys, CacheItem[] items, short onDataSourceItemUpdateCallbackId,
                                 Alachisoft.NCache.Web.Caching.Cache parent, string providerName, string cacheId, int methodOverload,
                                 string clientId, short updateCallbackId, short removeCallbackId, EventDataFilter updateCallbackDataFilter,
                                 EventDataFilter removeCallbackDataFilter, bool returnVersions,
                                 CallbackType callbackType = Runtime.Events.CallbackType.PushBasedNotification)
        {
            base.name = "BulkInsertCommand";

            _parent            = parent;
            base.BulkKeys      = keys;
            _bulkInsertCommand = new Alachisoft.NCache.Common.Protobuf.BulkInsertCommand();
            _bulkInsertCommand.datasourceUpdatedCallbackId = onDataSourceItemUpdateCallbackId;
            _bulkInsertCommand.providerName   = providerName;
            _bulkInsertCommand.returnVersions = returnVersions;
            _bulkInsertCommand.requestId      = base.RequestId;
            _methodOverload = methodOverload;

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

                _insertCommand     = new Alachisoft.NCache.Common.Protobuf.InsertCommand();
                _insertCommand.key = keys[i];

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

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


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

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

                _insertCommand.clientID     = clientId;
                _insertCommand.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);
                }


                _insertCommand.objectQueryInfo = objectQueryInfo;

                EventDataFilter itemUpdateDataFilter  = updateCallbackDataFilter;
                EventDataFilter itemRemovedDataFilter = removeCallbackDataFilter;

                if (item.CacheItemRemovedCallback != null)
                {
                    itemRemovedDataFilter = item.ItemRemovedCallabackDataFilter;
                    short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemRemovedCallback,
                                                                                       EventType.ItemRemoved, itemRemovedDataFilter);
                    removeCallbackId = callabackIds[1];
                }
                else if (item.ItemRemoveCallback != null)
                {
                    removeCallbackId      = _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;
                }

                _insertCommand.removeCallbackId   = removeCallbackId;
                _insertCommand.updateCallbackId   = updateCallbackId;
                _insertCommand.updateDataFilter   = (short)itemUpdateDataFilter;
                _insertCommand.removeDataFilter   = (short)itemRemovedDataFilter;
                _insertCommand.resyncProviderName = item.ResyncProviderName;

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

                _bulkInsertCommand.insertCommand.Add(_insertCommand);
            }
        }