Skip to content

Commit

Permalink
core/cache: cleanup & undo accidental changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mpranj committed Mar 26, 2019
1 parent 90b3349 commit b4b26dc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/libs/elektra/kdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ int kdbGet (KDB * handle, KeySet * ks, Key * parentKey)
}
else
{

/* Now do the real updating,
but not for bypassed keys in split->size-1 */
clearError (parentKey);
Expand Down Expand Up @@ -1067,6 +1068,7 @@ int kdbGet (KDB * handle, KeySet * ks, Key * parentKey)
elektraGlobalGet (handle, ks, parentKey, POSTGETSTORAGE, DEINIT);

ksRewind (ks);

keySetName (parentKey, keyName (initialParent));

splitUpdateFileName (split, handle, parentKey);
Expand Down Expand Up @@ -1387,7 +1389,6 @@ int kdbSet (KDB * handle, KeySet * ks, Key * parentKey)
}
ELEKTRA_LOG ("after splitBuildup");


// 1.) Search for syncbits
int syncstate = splitDivide (split, handle, ks);
if (syncstate == -1)
Expand Down
5 changes: 0 additions & 5 deletions src/libs/elektra/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,6 @@ KeySet * elektraDefaultGlobalConfig (void)
keyNew ("system/elektra/globalplugins/postcommit/user/plugins/#0/placements", KEY_VALUE, "spec", KEY_END),
keyNew ("system/elektra/globalplugins/postcommit/user/plugins/#0/placements/get", KEY_VALUE, "postgetstorage", KEY_END),
keyNew ("system/elektra/globalplugins/postcommit/user/plugins/#0/placements/set", KEY_VALUE, "presetstorage", KEY_END),
// keyNew ("system/elektra/globalplugins/postcommit/user/plugins/#1", KEY_VALUE, "cache", KEY_END),
// keyNew ("system/elektra/globalplugins/postcommit/user/plugins/#1/placements", KEY_VALUE, "cache", KEY_END),
// keyNew ("system/elektra/globalplugins/postcommit/user/plugins/#1/placements/get", KEY_VALUE, "pregetcache postgetcache",
// KEY_END), keyNew ("system/elektra/globalplugins/postcommit/user/plugins/#1/placements/set", KEY_VALUE, "postsetcache",
// KEY_END),
#endif
keyNew ("system/elektra/globalplugins/postgetstorage", KEY_VALUE, "list", KEY_END),
keyNew ("system/elektra/globalplugins/postgetcache", KEY_VALUE, "", KEY_END),
Expand Down
1 change: 0 additions & 1 deletion src/libs/elektra/split.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,6 @@ void splitPrepare (Split * split)
}
}


static char * elektraStrConcat (const char * a, const char * b)
{
size_t len = strlen (a) + strlen (b) + 1;
Expand Down
16 changes: 6 additions & 10 deletions src/plugins/cache/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
#include <kdbmodule.h>
#include <kdbprivate.h>

#include <fcntl.h> // access()
#include <stdio.h> // rename(), sprintf()
#include <sys/time.h> // gettimeofday()
#include <unistd.h> // access()
#include <fcntl.h> // access()
#include <stdio.h> // rename(), sprintf()
#include <sys/stat.h> // elektraMkdirParents
#include <sys/time.h> // gettimeofday()
#include <sys/types.h> // elektraMkdirParents
#include <unistd.h> // access()

#define KDB_CACHE_STORAGE "mmapstorage"
#define POSTFIX_SIZE 50
Expand Down Expand Up @@ -75,8 +77,6 @@ static int loadCacheStoragePlugin (Plugin * handle, CacheHandle * ch)
return 0;
}

#include <sys/stat.h>
#include <sys/types.h>
static int elektraMkdirParents (const char * pathname)
{
if (mkdir (pathname, KDB_FILE_MODE | KDB_DIR_MODE) == -1)
Expand Down Expand Up @@ -181,7 +181,6 @@ static char * kdbCacheFileName (CacheHandle * ch, Key * parentKey)
ELEKTRA_LOG_DEBUG ("mountpoint empty, invalid cache file name");
ELEKTRA_ASSERT (0 != 0, "mountpoint empty, invalid cache file name");
}
// cacheFileName = elektraStrConcat ("/tmp/elektracache/", keyName (parentKey));
ELEKTRA_LOG_DEBUG ("cache dir: %s", cacheFileName);

if (cacheFileName)
Expand Down Expand Up @@ -305,7 +304,6 @@ int elektraCacheSet (Plugin * handle, KeySet * returned, Key * parentKey)

if (elektraPluginGetGlobalKeySet (handle) == 0)
{
// ELEKTRA_ASSERT (0 != 0, "WHY AM I NOT GLOBAL KS");
return ELEKTRA_PLUGIN_STATUS_NO_UPDATE; // TODO: do we fail silently here?
}

Expand All @@ -321,7 +319,6 @@ int elektraCacheSet (Plugin * handle, KeySet * returned, Key * parentKey)

// write cache to temp file
keySetString (cacheFile, tmpFile);
// elektraFree (cacheFileName);
if (ch->cacheStorage->kdbSet (ch->cacheStorage, returned, cacheFile) == ELEKTRA_PLUGIN_STATUS_SUCCESS)
{
if (rename (tmpFile, cacheFileName) == -1)
Expand Down Expand Up @@ -358,7 +355,6 @@ int elektraCacheError (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA

if (elektraPluginGetGlobalKeySet (handle) == 0)
{
// ELEKTRA_ASSERT (0 != 0, "WHY AM I NOT GLOBAL KS");
return ELEKTRA_PLUGIN_STATUS_NO_UPDATE; // TODO: do we fail silently here?
}

Expand Down

0 comments on commit b4b26dc

Please sign in to comment.