Added private non-implemented copy constructor and assignment operators
for many classes for the sake of completeness. Added a Transaction::IsStarted() method to not let it look like as if the transaction is started more than once. Changes made after suggestions from Mike Nordell, again :-) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1067 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -162,7 +162,7 @@ class CachedNode {
|
||||
|
||||
class BPlusTree {
|
||||
public:
|
||||
BPlusTree(Transaction *transaction,Inode *stream,int32 nodeSize = BPLUSTREE_NODE_SIZE);
|
||||
BPlusTree(Transaction *transaction, Inode *stream, int32 nodeSize = BPLUSTREE_NODE_SIZE);
|
||||
BPlusTree(Inode *stream);
|
||||
BPlusTree();
|
||||
~BPlusTree();
|
||||
@@ -174,16 +174,16 @@ class BPlusTree {
|
||||
status_t InitCheck();
|
||||
status_t Validate();
|
||||
|
||||
status_t Remove(Transaction *transaction,const uint8 *key, uint16 keyLength, off_t value);
|
||||
status_t Insert(Transaction *transaction,const uint8 *key, uint16 keyLength, off_t value);
|
||||
status_t Remove(Transaction *transaction, const uint8 *key, uint16 keyLength, off_t value);
|
||||
status_t Insert(Transaction *transaction, const uint8 *key, uint16 keyLength, off_t value);
|
||||
|
||||
status_t Insert(Transaction *transaction,const char *key, off_t value);
|
||||
status_t Insert(Transaction *transaction,int32 key, off_t value);
|
||||
status_t Insert(Transaction *transaction,uint32 key, off_t value);
|
||||
status_t Insert(Transaction *transaction,int64 key, off_t value);
|
||||
status_t Insert(Transaction *transaction,uint64 key, off_t value);
|
||||
status_t Insert(Transaction *transaction,float key, off_t value);
|
||||
status_t Insert(Transaction *transaction,double key, off_t value);
|
||||
status_t Insert(Transaction *transaction, const char *key, off_t value);
|
||||
status_t Insert(Transaction *transaction, int32 key, off_t value);
|
||||
status_t Insert(Transaction *transaction, uint32 key, off_t value);
|
||||
status_t Insert(Transaction *transaction, int64 key, off_t value);
|
||||
status_t Insert(Transaction *transaction, uint64 key, off_t value);
|
||||
status_t Insert(Transaction *transaction, float key, off_t value);
|
||||
status_t Insert(Transaction *transaction, double key, off_t value);
|
||||
|
||||
status_t Replace(Transaction *transaction, const uint8 *key, uint16 keyLength, off_t value);
|
||||
status_t Find(const uint8 *key, uint16 keyLength, off_t *value);
|
||||
@@ -192,6 +192,10 @@ class BPlusTree {
|
||||
static int32 ModeToKeyType(mode_t mode);
|
||||
|
||||
private:
|
||||
BPlusTree(const BPlusTree &);
|
||||
BPlusTree &operator=(const BPlusTree &);
|
||||
// no implementation
|
||||
|
||||
int32 CompareKeys(const void *key1, int keylength1, const void *key2, int keylength2);
|
||||
status_t FindKey(bplustree_node *node, const uint8 *key, uint16 keyLength, uint16 *index = NULL, off_t *next = NULL);
|
||||
status_t SeekDown(Stack<node_and_key> &stack, const uint8 *key, uint16 keyLength);
|
||||
|
||||
@@ -92,6 +92,7 @@ AllocationBlock::IsUsed(uint16 block)
|
||||
{
|
||||
if (block > fNumBits)
|
||||
return true;
|
||||
// the block bitmap is accessed in 32-bit blocks
|
||||
return ((uint32 *)fBlock)[block >> 5] & (1UL << (block % 32));
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@ class Index {
|
||||
status_t UpdateLastModified(Transaction *transaction, Inode *inode,off_t modified = -1);
|
||||
|
||||
private:
|
||||
Index(const Index &);
|
||||
Index &operator=(const Index &);
|
||||
// no implementation
|
||||
|
||||
Volume *fVolume;
|
||||
Inode *fNode;
|
||||
const char *fName;
|
||||
|
||||
@@ -110,6 +110,11 @@ class CachedBlock {
|
||||
uint32 BlockSize() const { return fVolume->BlockSize(); }
|
||||
uint32 BlockShift() const { return fVolume->BlockShift(); }
|
||||
|
||||
private:
|
||||
CachedBlock(const CachedBlock &);
|
||||
CachedBlock &operator=(const CachedBlock &);
|
||||
// no implementation
|
||||
|
||||
protected:
|
||||
Volume *fVolume;
|
||||
off_t fBlockNumber;
|
||||
@@ -198,6 +203,10 @@ class Inode : public CachedBlock {
|
||||
off_t OldLastModified() { return fOldLastModified; }
|
||||
|
||||
private:
|
||||
Inode(const Inode &);
|
||||
Inode &operator=(const Inode &);
|
||||
// no implementation
|
||||
|
||||
friend AttributeIterator;
|
||||
|
||||
status_t RemoveSmallData(small_data *item,int32 index);
|
||||
|
||||
@@ -125,6 +125,7 @@ class Transaction {
|
||||
}
|
||||
|
||||
status_t Start(Volume *volume, off_t refBlock);
|
||||
bool IsStarted() const { return fJournal != NULL; }
|
||||
|
||||
void Done()
|
||||
{
|
||||
@@ -143,7 +144,11 @@ class Transaction {
|
||||
|
||||
Volume *GetVolume() { return fJournal != NULL ? fJournal->GetVolume() : NULL; }
|
||||
|
||||
protected:
|
||||
private:
|
||||
Transaction(const Transaction &);
|
||||
Transaction &operator=(const Transaction &);
|
||||
// no implementation
|
||||
|
||||
Journal *fJournal;
|
||||
};
|
||||
|
||||
|
||||
@@ -141,6 +141,10 @@ class Equation : public Term {
|
||||
#endif
|
||||
|
||||
private:
|
||||
Equation(const Equation &);
|
||||
Equation &operator=(const Equation &);
|
||||
// no implementation
|
||||
|
||||
status_t ConvertValue(type_code type);
|
||||
bool CompareTo(const uint8 *value, uint16 size);
|
||||
uint8 *Value() const { return (uint8 *)&fValue; }
|
||||
@@ -166,12 +170,13 @@ class Operator : public Term {
|
||||
Term *Left() const { return fLeft; }
|
||||
Term *Right() const { return fRight; }
|
||||
|
||||
virtual status_t Match(Inode *inode,const char *attribute = NULL,int32 type = 0,const uint8 *key = NULL,size_t size = 0);
|
||||
virtual status_t Match(Inode *inode, const char *attribute = NULL, int32 type = 0,
|
||||
const uint8 *key = NULL, size_t size = 0);
|
||||
virtual void Complement();
|
||||
|
||||
|
||||
virtual void CalculateScore(Index &index);
|
||||
virtual int32 Score() const;
|
||||
|
||||
|
||||
virtual status_t InitCheck();
|
||||
|
||||
//Term *Copy() const;
|
||||
@@ -179,7 +184,11 @@ class Operator : public Term {
|
||||
virtual void PrintToStream();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
private:
|
||||
Operator(const Operator &);
|
||||
Operator &operator=(const Operator &);
|
||||
// no implementation
|
||||
|
||||
Term *fLeft,*fRight;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@ class Expression {
|
||||
bool IsOperator(char **expr,char op);
|
||||
|
||||
private:
|
||||
Expression(const Expression &);
|
||||
Expression &operator=(const Expression &);
|
||||
// no implementation
|
||||
|
||||
char *fPosition;
|
||||
Term *fTerm;
|
||||
};
|
||||
|
||||
@@ -496,7 +496,9 @@ Stream<Cache>::WriteAt(Transaction *transaction, off_t pos, const uint8 *buffer,
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// the transaction doesn't have to be started already
|
||||
if ((Flags() & INODE_NO_TRANSACTION) == 0)
|
||||
// ToDo: what's that INODE_NO_TRANSACTION flag good for again?
|
||||
if ((Flags() & INODE_NO_TRANSACTION) == 0
|
||||
&& !transaction->IsStarted())
|
||||
transaction->Start(fVolume, BlockNumber());
|
||||
|
||||
// let's grow the data stream to the size needed
|
||||
@@ -519,7 +521,8 @@ Stream<Cache>::WriteAt(Transaction *transaction, off_t pos, const uint8 *buffer,
|
||||
}
|
||||
|
||||
bool logStream = (Flags() & INODE_LOGGED) == INODE_LOGGED;
|
||||
if (logStream)
|
||||
if (logStream
|
||||
&& !transaction->IsStarted())
|
||||
transaction->Start(fVolume, BlockNumber());
|
||||
|
||||
uint32 bytesWritten = 0;
|
||||
|
||||
@@ -1170,7 +1170,7 @@ bfs_write(void *_ns, void *_node, void *_cookie, off_t pos, const void *buffer,
|
||||
// it might not be needed at all
|
||||
|
||||
status_t status = inode->WriteAt(&transaction,pos,(const uint8 *)buffer,_length);
|
||||
|
||||
|
||||
if (status == B_OK)
|
||||
transaction.Done();
|
||||
|
||||
@@ -1186,7 +1186,7 @@ bfs_write(void *_ns, void *_node, void *_cookie, off_t pos, const void *buffer,
|
||||
cookie->last_size = inode->Size();
|
||||
cookie->last_notification = system_time();
|
||||
}
|
||||
|
||||
|
||||
// This will flush the dirty blocks to disk from time to time.
|
||||
// It's done here and not in Inode::WriteAt() so that it won't
|
||||
// add to the duration of a transaction - it might even be a
|
||||
|
||||
Reference in New Issue
Block a user