AuroraRuntime/Include/Aurora/IO/FS/Watcher.hpp
J Reece Wilson 3defb1bb14 [+] Linux Watcher
[*] Expand watcher API -> Breaking NT
[*] Reexpand loop queue API -> Breaking NT
[*] Linux CPUInfo clean up
[*] Bug fix: mkdir should set execute flag... because directories are special
[*] Refactor: Cleanup base64
[*] Bug fix: UNIX path normalization
[*] Bug fix: missing O_CREAT flag (au auto-creates)
[*] Normalize line endings
2022-04-10 16:40:49 +01:00

60 lines
1.3 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Watcher.hpp
Date: 2022-4-1
Author: Reece
***/
#pragma once
namespace Aurora::IO::FS
{
struct UserWatchData
{
virtual ~UserWatchData() {};
};
struct WatchedFile
{
AuSPtr<UserWatchData> userData;
AuString path;
};
AUE_DEFINE(EWatchEvent,
(
eSelfModify,
eSelfDelete,
eFileModify,
eFileDelete,
eFileCreate
));
struct WatchRequest
{
WatchedFile watch;
// events are mere optimization hint. additional events may be provided, if available.
AuList<EWatchEvent> events;
};
struct WatchEvent
{
EWatchEvent event;
WatchedFile watch;
AuString file;
};
struct IWatcher
{
virtual bool AddWatch(const WatchRequest &file) = 0;
virtual bool RemoveByName(const AuString &path) = 0;
virtual bool RemoveByPrivateContext(const AuSPtr<UserWatchData> &file) = 0;
virtual AuSPtr<Loop::ILoopSource> AsLoopSource() = 0;
virtual AuList<WatchEvent> QueryUpdates() = 0;
};
AUKN_SHARED_API(NewWatcher, IWatcher);
}