public void Add(string storeName, IIndexStore store, INodeReference node) { IndexStoreInformation ni = new IndexStoreInformation(storeName, store, node); if (_nodeInfo == null) { _nodeInfo = ni; _nodeInfoMaxCount = _nodeInfoMaxCount < 1 ? (ushort)1 : _nodeInfoMaxCount; } else { if (_nodeInfo is IndexStoreInformation) { ClusteredList<IndexStoreInformation> _list = new ClusteredList<IndexStoreInformation>(); _list.Add((IndexStoreInformation)_nodeInfo); _list.Add(ni); _nodeInfo = _list; if (_list.Count > _nodeInfoMaxCount) _nodeInfoMaxCount = (ushort)_list.Count; } else { ClusteredList<IndexStoreInformation> _list = ((ClusteredList<IndexStoreInformation>)_nodeInfo); _list.Add(ni); if (_list.Count > _nodeInfoMaxCount) _nodeInfoMaxCount = (ushort)_list.Count; } } _indexInformationSize += (ushort)ni.IndexInMemorySize; }
public void Add(string storeName, IIndexStore store, INodeReference node) { IndexStoreInformation ni = new IndexStoreInformation(storeName, store, node); if (_nodeInfo == null) { _nodeInfo = ni; _nodeInfoMaxCount = _nodeInfoMaxCount < 1 ? (ushort)1 : _nodeInfoMaxCount; } else { if (_nodeInfo is IndexStoreInformation) { ClusteredList <IndexStoreInformation> _list = new ClusteredList <IndexStoreInformation>(); _list.Add((IndexStoreInformation)_nodeInfo); _list.Add(ni); _nodeInfo = _list; if (_list.Count > _nodeInfoMaxCount) { _nodeInfoMaxCount = (ushort)_list.Count; } } else { ClusteredList <IndexStoreInformation> _list = ((ClusteredList <IndexStoreInformation>)_nodeInfo); _list.Add(ni); if (_list.Count > _nodeInfoMaxCount) { _nodeInfoMaxCount = (ushort)_list.Count; } } } _indexInformationSize += (ushort)ni.IndexInMemorySize; }
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { ArrayList collection = new ArrayList(); if (context != null) { INodeReference node = context.Instance as INodeReference; if ((node != null) && (node.Node != null)) { foreach (PropertyInfo propertyInfo in node.Node.GetType().GetProperties()) { if (propertyInfo.CanRead && propertyInfo.CanWrite) { bool browseableFlag = true; Object[] attributes = (Object[])propertyInfo.GetCustomAttributes(true); foreach (Attribute attribute in attributes) { if ((attribute is BrowsableAttribute) && (((BrowsableAttribute)attribute).Browsable == false)) { browseableFlag = false; break; } } if (browseableFlag) { collection.Add(propertyInfo.Name); } } } } collection.Sort(CaseInsensitiveComparer.Default); } collection.Insert(0, null); return(new TypeConverter.StandardValuesCollection(collection)); }
public virtual void AddToIndex(object key, object value) { lock (_mutex) { QueryItemContainer container = (QueryItemContainer)value; CacheEntry entry = container.Item; Hashtable attributeValues = container.ItemArrtributes; IDictionaryEnumerator valuesDic = attributeValues.GetEnumerator(); INodeReference keyNode = null; while (valuesDic.MoveNext()) { string indexKey = (string)valuesDic.Key; string storeName = indexKey; IIndexStore store = _indexTable[indexKey] as IIndexStore; keyNode = null; if (store != null) { long prev = store.IndexInMemorySize; object val = valuesDic.Value; if (val != null) { keyNode = (INodeReference)store.Add(val, key); } _attributeIndexSize += store.IndexInMemorySize - prev; } storeName = Common.Util.StringPool.PoolString(storeName); IndexInformation info; if (entry.IndexInfo != null) { info = entry.IndexInfo; } else { info = new IndexInformation(); } long prevSize = info.IndexInMemorySize; info.Add(storeName, store, keyNode); this._keyIndexInformationSize += info.IndexInMemorySize - prevSize; entry.IndexInfo = info; } } }
/// <summary> /// The sequence of the ref node in refList must be strictly the same with /// the sequence in fsimage /// </summary> /// <exception cref="System.IO.IOException"/> public void LoadINodeReferenceSection(InputStream @in) { IList <INodeReference> refList = parent.GetLoaderContext().GetRefList(); while (true) { FsImageProto.INodeReferenceSection.INodeReference e = FsImageProto.INodeReferenceSection.INodeReference .ParseDelimitedFrom(@in); if (e == null) { break; } INodeReference @ref = LoadINodeReference(e); refList.AddItem(@ref); } }
/// <exception cref="System.IO.IOException"/> private FsImageProto.INodeReferenceSection.INodeReference.Builder BuildINodeReference (INodeReference @ref) { FsImageProto.INodeReferenceSection.INodeReference.Builder rb = FsImageProto.INodeReferenceSection.INodeReference .NewBuilder().SetReferredId(@ref.GetId()); if (@ref is INodeReference.WithName) { rb.SetLastSnapshotId(((INodeReference.WithName)@ref).GetLastSnapshotId()).SetName (ByteString.CopyFrom(@ref.GetLocalNameBytes())); } else { if (@ref is INodeReference.DstReference) { rb.SetDstSnapshotId(@ref.GetDstSnapshotId()); } } return(rb); }
/// <summary>Load the deleted list in a DirectoryDiff</summary> /// <exception cref="System.IO.IOException"/> private IList <INode> LoadDeletedList(IList <INodeReference> refList, InputStream @in , INodeDirectory dir, IList <long> deletedNodes, IList <int> deletedRefNodes) { IList <INode> dlist = new AList <INode>(deletedRefNodes.Count + deletedNodes.Count); // load non-reference inodes foreach (long deletedId in deletedNodes) { INode deleted = fsDir.GetInode(deletedId); dlist.AddItem(deleted); AddToDeletedList(deleted, dir); } // load reference nodes in the deleted list foreach (int refId in deletedRefNodes) { INodeReference deletedRef = refList[refId]; dlist.AddItem(deletedRef); AddToDeletedList(deletedRef, dir); } dlist.Sort(new _IComparer_303()); return(dlist); }
public IndexStoreInformation(string storeName, IIndexStore store, INodeReference node) { _rbnodes = node; _store = store; _storeName = storeName; }
public IndexStoreInformation() { _rbnodes = new RedBlackNodeReference<int>(); }
public IndexStoreInformation(string storeName, IIndexStore store, INodeReference node) { _rbnodes = node; _store = store; _storeName = storeName; }
public IndexStoreInformation() { _rbnodes = new RedBlackNodeReference <int>(); }