Clear() public method

Sets EOF pointer to 0.

USE withInternalArrayResize by necessity. If it's true then array will be re-initialized to initial capacity

this also will call GC and the whole process will take some time.

If false, only pointer EOF will be set to 0, capacity of the array will not be changed - very fast

public Clear ( bool withInternalArrayResize ) : void
withInternalArrayResize bool
return void
Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="newTableFullPath"></param>
        public void RestoreTableFromTheOtherTable(string newTableFullPath)
        {
            lock (lock_fs)
            {
                if (_fsData != null)
                {
                    _fsData.Dispose();
                    _fsData = null;
                }

                if (_fsRollback != null)
                {
                    _fsRollback.Dispose();
                    _fsRollback = null;
                }

                if (_fsRollbackHelper != null)
                {
                    _fsRollbackHelper.Dispose();
                    _fsRollbackHelper = null;
                }

                _randBuf.Clear();
                _rollbackCache.Clear();
                usedBufferSize = 0;
                eofRollback    = 0;
                eofData        = 0;
                fsLength       = 0;
                _seqBuf.Clear(true);


                this._configuration.FSFactory.Delete(this._fileName);
                this._configuration.FSFactory.Delete(this._fileName + ".rol");
                this._configuration.FSFactory.Delete(this._fileName + ".rhp");
                //File.Delete(this._fileName);
                //File.Delete(this._fileName + ".rol");
                //File.Delete(this._fileName + ".rhp");

                if (this._configuration.FSFactory.Exists(newTableFullPath))
                {
                    this._configuration.FSFactory.Move(newTableFullPath, this._fileName);
                }

                if (this._configuration.FSFactory.Exists(newTableFullPath + ".rol"))
                {
                    this._configuration.FSFactory.Move(newTableFullPath + ".rol", this._fileName + ".rol");
                }

                if (this._configuration.FSFactory.Exists(newTableFullPath + ".rhp"))
                {
                    this._configuration.FSFactory.Move(newTableFullPath + ".rhp", this._fileName + ".rhp");
                }

                InitFiles();
            }
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        public void RecreateFiles()
        {
            lock (lock_fs)
            {
                RIC.DeleteRemoteTable();
                //if (_fsData != null)
                //{
                //    _fsData.Close();
                //    _fsData.Dispose();
                //    _fsData = null;
                //}

                //if (_fsRollback != null)
                //{
                //    _fsRollback.Close();
                //    _fsRollback.Dispose();
                //    _fsRollback = null;
                //}

                //if (_fsRollbackHelper != null)
                //{
                //    _fsRollbackHelper.Close();
                //    _fsRollbackHelper.Dispose();
                //    _fsRollbackHelper = null;
                //}

                _randBuf.Clear();
                _rollbackCache.Clear();
                usedBufferSize = 0;
                eofRollback = 0;
                eofData = 0;
                _seqBuf.Clear(true);

                //File.Delete(this._fileName);
                //File.Delete(this._fileName + ".rol");
                //File.Delete(this._fileName + ".rhp");
                
                InitFiles();

            }
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        public void RecreateFiles()
        {
            lock (lock_fs)
            {
                _fsData.Clear(true);
                _fsRollback.Clear(true);
                _fsRollbackHelper.Clear(true);

                _randBuf.Clear();
                _rollbackCache.Clear();
                usedBufferSize = 0;
                eofRollback    = 0;
                eofData        = 0;

                InitFiles();
            }
        }