xref: /haiku/src/add-ons/kernel/file_systems/bfs/Index.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 /* Index - index access functions
2  *
3  * Copyright 2001-2004, Axel Dörfler, axeld@pinc-software.de.
4  * This file may be used under the terms of the MIT License.
5  */
6 #ifndef INDEX_H
7 #define INDEX_H
8 
9 
10 #include <KernelExport.h>
11 
12 class Transaction;
13 class Volume;
14 class Inode;
15 
16 
17 class Index {
18 	public:
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, uint32 type);
30 
31 		status_t Update(Transaction &transaction, const char *name, int32 type, const uint8 *oldKey,
32 					uint16 oldLength, const uint8 *newKey, uint16 newLength, Inode *inode);
33 
34 		status_t InsertName(Transaction &transaction, const char *name, Inode *inode);
35 		status_t RemoveName(Transaction &transaction, const char *name, Inode *inode);
36 		status_t UpdateName(Transaction &transaction, const char *oldName, const char *newName,
37 					Inode *inode);
38 
39 		status_t InsertSize(Transaction &transaction, Inode *inode);
40 		status_t RemoveSize(Transaction &transaction, Inode *inode);
41 		status_t UpdateSize(Transaction &transaction, Inode *inode);
42 
43 		status_t InsertLastModified(Transaction &transaction, Inode *inode);
44 		status_t RemoveLastModified(Transaction &transaction, Inode *inode);
45 		status_t UpdateLastModified(Transaction &transaction, Inode *inode, off_t modified = -1);
46 
47 	private:
48 		Index(const Index &);
49 		Index &operator=(const Index &);
50 			// no implementation
51 
52 		Volume		*fVolume;
53 		Inode		*fNode;
54 		const char	*fName;
55 };
56 
57 #endif	/* INDEX_H */
58