Example #1
0
        public Boolean Equals(AttributeIndex p)
        {
            // If parameter is null return false:
            if ((object)p == null)
            {
                return false;
            }

            if (this.IndexName != p.IndexName)
            {
                return false;
            }

            if (this.IndexEdition != p.IndexEdition)
            {
                return false;
            }

            if (this.IndexKeyDefinition != p.IndexKeyDefinition)
            {
                return false;
            }

            return true;
        }
Example #2
0
        /// <summary>
        /// Create a new Index
        /// </summary>
        /// <param name="myIndexName"></param>
        /// <param name="myAttributeUUIDs"></param>
        /// <param name="myIndexEdition"></param>
        /// <param name="myIndexType">The index type name</param>
        /// <param name="myFileSystemLocation"></param>
        /// <returns></returns>
        public Exceptional<AttributeIndex> CreateAttributeIndex(DBContext myDBContext, String myIndexName, List<AttributeUUID> myAttributeUUIDs, String myIndexEdition, String myIndexType = null)
        {
            if (!String.IsNullOrEmpty(myIndexType))
            {

                #region Verify IndexType

                if (!myDBContext.DBPluginManager.HasIndex(myIndexType))
                {
                    return new Exceptional<AttributeIndex>(new Error_IndexTypeDoesNotExist(myIndexType));
                }

                #endregion

            }

            var attributeIdxShards = UInt16.Parse(myDBContext.GraphAppSettings.Get<AttributeIdxShardsSetting>());

            var _NewAttributeIndex = new AttributeIndex(myIndexName, myIndexEdition, myAttributeUUIDs, this, attributeIdxShards, myIndexType);

            var CreateExcept = AddAttributeIndex(_NewAttributeIndex, myDBContext);

            if (CreateExcept.Failed())
            {
                return new Exceptional<AttributeIndex>(CreateExcept);
            }

            return new Exceptional<AttributeIndex>(_NewAttributeIndex);
        }