aqhome: make datafile a virtual class. Add datafile_direct.

this is to allow for cached data file handling later.
This commit is contained in:
Martin Preuss
2024-02-11 22:21:49 +01:00
parent 5888bc9068
commit 793d12693b
8 changed files with 636 additions and 458 deletions

View File

@@ -13,6 +13,7 @@
#include "aqhome/data/storage_p.h"
#include "aqhome/data/storage_readxml.h"
#include "aqhome/data/storage_writexml.h"
#include "aqhome/data/datafile_direct.h"
#include <gwenhywfar/debug.h>
#include <gwenhywfar/xml.h>
@@ -353,7 +354,7 @@ int AQH_Storage_Fini(AQH_STORAGE *sto)
AQH_DataFile_List_Del(df);
rv=AQH_DataFile_Close(df);
if (rv<0) {
DBG_INFO(AQH_LOGDOMAIN, "Error closing file \"%s\"", AQH_DataFile_GetFileName(df));
DBG_INFO(AQH_LOGDOMAIN, "Error closing file \"%lu\"", AQH_DataFile_GetValueId(df));
errors++;
}
AQH_DataFile_free(df);
@@ -625,7 +626,7 @@ AQH_DATAFILE *_openOrCreateDataFileByValueId(AQH_STORAGE *sto, uint64_t valueId)
int rv;
nameBuf=_getDataFilePathForValueId(sto, valueId);
df=AQH_DataFile_new(GWEN_Buffer_GetStart(nameBuf), valueId);
df=AQH_DataFileDirect_new(GWEN_Buffer_GetStart(nameBuf), valueId);
rv=GWEN_Directory_GetPath(GWEN_Buffer_GetStart(nameBuf),
GWEN_PATH_FLAGS_CHECKROOT |