1/*
2 * Copyright 2001-2012, Axel D��rfler, axeld@pinc-software.de.
3 * This file may be used under the terms of the MIT License.
4 */
5#ifndef INDEX_H
6#define INDEX_H
7
8
9#include "system_dependencies.h"
10
11
12class Transaction;
13class Volume;
14class Inode;
15
16
17class Index {
18public:
19							Index(Volume* volume);
20							~Index();
21
22			status_t		SetTo(const char* name);
23			void			Unset();
24
25			Inode*			Node() const { return fNode; };
26			uint32			Type();
27			size_t			KeySize();
28
29			status_t		Create(Transaction& transaction, const char* name,
30								uint32 type);
31
32			status_t		Update(Transaction& transaction, const char* name,
33								int32 type, const uint8* oldKey,
34								uint16 oldLength, const uint8* newKey,
35								uint16 newLength, Inode* inode);
36
37			status_t		InsertName(Transaction& transaction,
38								const char* name, Inode* inode);
39			status_t		RemoveName(Transaction& transaction,
40								const char* name, Inode* inode);
41			status_t		UpdateName(Transaction& transaction,
42								const char* oldName, const char* newName,
43								Inode* inode);
44
45			status_t		InsertSize(Transaction& transaction, Inode* inode);
46			status_t		RemoveSize(Transaction& transaction, Inode* inode);
47			status_t		UpdateSize(Transaction& transaction, Inode* inode);
48
49			status_t		InsertLastModified(Transaction& transaction,
50								Inode* inode);
51			status_t		RemoveLastModified(Transaction& transaction,
52								Inode* inode);
53			status_t		UpdateLastModified(Transaction& transaction,
54								Inode* inode, bigtime_t modified = -1);
55
56private:
57							Index(const Index& other);
58							Index& operator=(const Index& other);
59								// no implementation
60
61private:
62			Volume*			fVolume;
63			Inode*			fNode;
64			const char*		fName;
65};
66
67
68#endif	// INDEX_H
69