Commit 62e57236 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Virtualize streamSync.

parent 905bc72d
......@@ -368,6 +368,8 @@ void
cdiStreamCloseDefaultDelegate(stream_t *streamptr,
int recordBufIsToBeDeleted);
void cdiStreamSync_(stream_t *streamptr);
char *cdiUnitNamePtr(int cdi_unit);
......
......@@ -35,6 +35,7 @@ static int activeNamespace = 0;
cdiStreamWriteVar_, \
cdiStreamwriteVarChunk_, \
cdiStreamCloseDefaultDelegate, \
cdiStreamSync_, \
CDI_NETCDF_SWITCHES \
}
......
......@@ -33,6 +33,7 @@ enum namespaceSwitch
NSSWITCH_STREAM_WRITE_VAR_,
NSSWITCH_STREAM_WRITE_VAR_CHUNK_,
NSSWITCH_STREAM_CLOSE_BACKEND,
NSSWITCH_STREAM_SYNC,
#ifdef HAVE_LIBNETCDF
NSSWITCH_NC__CREATE,
NSSWITCH_CDF_DEF_VAR,
......
......@@ -98,12 +98,13 @@ static void
cdiPioCdfDefTimestepNOP(stream_t *streamptr, int tsID)
{
}
#endif
static void
cdiPioClientCdfDefVarsNOP(stream_t *streamptr)
cdiPioClientStreamNOP(stream_t *streamptr)
{
}
#endif
static void
cdiPioClientStreamClose(stream_t *streamptr, int recordBufIsToBeDeleted)
......@@ -139,9 +140,10 @@ cdiPioClientSetup(int *pioNamespace_, int *pioNamespace)
namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_CHUNK_,
cdiPioClientStreamWriteVarChunk_);
namespaceSwitchSet(NSSWITCH_STREAM_CLOSE_BACKEND, cdiPioClientStreamClose);
namespaceSwitchSet(NSSWITCH_STREAM_SYNC, cdiPioClientStreamNOP);
#ifdef HAVE_LIBNETCDF
namespaceSwitchSet(NSSWITCH_CDF_DEF_TIMESTEP, cdiPioCdfDefTimestepNOP);
namespaceSwitchSet(NSSWITCH_CDF_STREAM_SETUP, cdiPioClientCdfDefVarsNOP);
namespaceSwitchSet(NSSWITCH_CDF_STREAM_SETUP, cdiPioClientStreamNOP);
#endif
pioNamespaceSetActive(callerCDINamespace);
}
......
......@@ -1217,37 +1217,12 @@ void streamClose(int streamID)
stream_delete_entry(streamptr);
}
/*
@Function streamSync
@Title Synchronize an Open Dataset to Disk
@Prototype void streamSync(int streamID)
@Parameter
@Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}.
@Description
The function @func{streamSync} offers a way to synchronize the disk copy of a dataset with in-memory buffers.
@EndFunction
*/
void streamSync(int streamID)
void cdiStreamSync_(stream_t *streamptr)
{
int filetype;
int fileID;
int vlistID;
int nvars;
stream_t *streamptr;
if ( !namespaceHasLocalFile ( namespaceGetActive ())) return;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
fileID = streamptr->fileID;
filetype = streamptr->filetype;
vlistID = streamptr->vlistID;
nvars = vlistNvars(vlistID);
int fileID = streamptr->fileID;
int filetype = streamptr->filetype;
int vlistID = streamptr->vlistID;
int nvars = vlistNvars(vlistID);
if ( fileID == CDI_UNDEFID )
Warning("File %s not open!", streamptr->filename);
......@@ -1282,6 +1257,32 @@ void streamSync(int streamID)
}
}
/*
@Function streamSync
@Title Synchronize an Open Dataset to Disk
@Prototype void streamSync(int streamID)
@Parameter
@Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}.
@Description
The function @func{streamSync} offers a way to synchronize the disk copy of a dataset with in-memory buffers.
@EndFunction
*/
void streamSync(int streamID)
{
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
void (*myStreamSync_)(stream_t *streamptr)
= namespaceSwitchGet(NSSWITCH_STREAM_SYNC);
myStreamSync_(streamptr);
}
/*
@Function streamDefTimestep
@Title Define time step
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment