xref: /haiku/src/add-ons/kernel/file_systems/bfs/Query.h (revision b8a45b3a2df2379b4301bf3bd5949b9a105be4ba)
1 /*
2  * Copyright 2001-2008, Axel Dörfler, axeld@pinc-software.de.
3  * Copyright 2024, Haiku, Inc. All rights reserved.
4  * This file may be used under the terms of the MIT License.
5  */
6 #ifndef QUERY_H
7 #define QUERY_H
8 
9 #include "system_dependencies.h"
10 
11 #include "Index.h"
12 
13 
14 namespace QueryParser {
15 	template<typename QueryPolicy> class Query;
16 };
17 
18 class Volume;
19 
20 
21 class Query : public DoublyLinkedListLinkImpl<Query> {
22 public:
23 							~Query();
24 
25 	static	status_t		Create(Volume* volume, const char* queryString,
26 								uint32 flags, port_id port, uint32 token,
27 								Query*& _query);
28 
29 			status_t		Rewind();
30 			status_t		GetNextEntry(struct dirent* entry, size_t size);
31 
32 			void			LiveUpdate(Inode* inode,
33 								const char* attribute, int32 type,
34 								const void* oldKey, size_t oldLength,
35 								const void* newKey, size_t newLength);
36 			void			LiveUpdateRenameMove(Inode* node,
37 								ino_t oldDirectoryID, const char* oldName,
38 								size_t oldLength, ino_t newDirectoryID,
39 								const char* newName, size_t newLength);
40 private:
41 			struct QueryPolicy;
42 			friend struct QueryPolicy;
43 			typedef QueryParser::Query<QueryPolicy> QueryImpl;
44 
45 private:
46 							Query(Volume* volume);
47 
48 			status_t		_Init(const char* queryString, uint32 flags,
49 								port_id port, uint32 token);
50 
51 private:
52 			Volume*			fVolume;
53 			QueryImpl*		fImpl;
54 };
55 
56 
57 #endif	// QUERY_H
58