New upstream version 8.1.0
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "CloseFileMsg.h"
|
||||
|
||||
|
||||
const struct NetMessageOps CloseFileMsg_Ops = {
|
||||
.serializePayload = CloseFileMsg_serializePayload,
|
||||
.deserializePayload = _NetMessage_deserializeDummy,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
.supportsSequenceNumbers = true,
|
||||
};
|
||||
|
||||
void CloseFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
|
||||
{
|
||||
CloseFileMsg* thisCast = (CloseFileMsg*)this;
|
||||
|
||||
// clientNumID
|
||||
NumNodeID_serialize(ctx, &thisCast->clientNumID);
|
||||
|
||||
// fileHandleID
|
||||
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
|
||||
|
||||
// entryInfo
|
||||
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
|
||||
|
||||
// maxUsedNodeIndex
|
||||
Serialization_serializeInt(ctx, thisCast->maxUsedNodeIndex);
|
||||
|
||||
if (this->msgHeader.msgFeatureFlags & CLOSEFILEMSG_FLAG_HAS_EVENT)
|
||||
FileEvent_serialize(ctx, thisCast->fileEvent);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#ifndef CLOSEFILEMSG_H_
|
||||
#define CLOSEFILEMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/storage/EntryInfo.h>
|
||||
#include <common/storage/FileEvent.h>
|
||||
|
||||
|
||||
#define CLOSEFILEMSG_FLAG_EARLYRESPONSE 1 /* send response before chunk files close */
|
||||
#define CLOSEFILEMSG_FLAG_CANCELAPPENDLOCKS 2 /* cancel append locks of this file handle */
|
||||
#define CLOSEFILEMSG_FLAG_HAS_EVENT 8 /* contains file event logging information */
|
||||
|
||||
/**
|
||||
* This message supports sending (serialization) only, i.e. no deserialization implemented!!
|
||||
*/
|
||||
|
||||
struct CloseFileMsg;
|
||||
typedef struct CloseFileMsg CloseFileMsg;
|
||||
|
||||
static inline void CloseFileMsg_init(CloseFileMsg* this);
|
||||
static inline void CloseFileMsg_initFromSession(CloseFileMsg* this, NumNodeID clientNumID,
|
||||
const char* fileHandleID, const EntryInfo* entryInfo, int maxUsedNodeIndex,
|
||||
const struct FileEvent* fileEvent);
|
||||
|
||||
// virtual functions
|
||||
extern void CloseFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
|
||||
|
||||
|
||||
struct CloseFileMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
NumNodeID clientNumID;
|
||||
|
||||
unsigned fileHandleIDLen;
|
||||
const char* fileHandleID;
|
||||
int maxUsedNodeIndex;
|
||||
|
||||
// for serialization
|
||||
const EntryInfo* entryInfoPtr; // not owned by this object
|
||||
const struct FileEvent* fileEvent;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps CloseFileMsg_Ops;
|
||||
|
||||
void CloseFileMsg_init(CloseFileMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_CloseFile, &CloseFileMsg_Ops);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fileHandleID just a reference, so do not free it as long as you use this object!
|
||||
* @param entryInfo just a reference, so do not free it as long as you use this object!
|
||||
*/
|
||||
void CloseFileMsg_initFromSession(CloseFileMsg* this, NumNodeID clientNumID,
|
||||
const char* fileHandleID, const EntryInfo* entryInfo, int maxUsedNodeIndex,
|
||||
const struct FileEvent* fileEvent)
|
||||
{
|
||||
CloseFileMsg_init(this);
|
||||
|
||||
this->clientNumID = clientNumID;
|
||||
|
||||
this->fileHandleID = fileHandleID;
|
||||
this->fileHandleIDLen = strlen(fileHandleID);
|
||||
|
||||
this->entryInfoPtr = entryInfo;
|
||||
|
||||
this->maxUsedNodeIndex = maxUsedNodeIndex;
|
||||
this->fileEvent = fileEvent;
|
||||
|
||||
if (fileEvent)
|
||||
this->netMessage.msgHeader.msgFeatureFlags |= CLOSEFILEMSG_FLAG_HAS_EVENT;
|
||||
}
|
||||
|
||||
#endif /*CLOSEFILEMSG_H_*/
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef CLOSEFILERESPMSG_H_
|
||||
#define CLOSEFILERESPMSG_H_
|
||||
|
||||
#include <common/net/message/SimpleIntMsg.h>
|
||||
|
||||
|
||||
struct CloseFileRespMsg;
|
||||
typedef struct CloseFileRespMsg CloseFileRespMsg;
|
||||
|
||||
static inline void CloseFileRespMsg_init(CloseFileRespMsg* this);
|
||||
|
||||
// getters & setters
|
||||
static inline int CloseFileRespMsg_getValue(CloseFileRespMsg* this);
|
||||
|
||||
struct CloseFileRespMsg
|
||||
{
|
||||
SimpleIntMsg simpleIntMsg;
|
||||
};
|
||||
|
||||
|
||||
void CloseFileRespMsg_init(CloseFileRespMsg* this)
|
||||
{
|
||||
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_CloseFileResp);
|
||||
}
|
||||
|
||||
int CloseFileRespMsg_getValue(CloseFileRespMsg* this)
|
||||
{
|
||||
return SimpleIntMsg_getValue( (SimpleIntMsg*)this);
|
||||
}
|
||||
|
||||
|
||||
#endif /*CLOSEFILERESPMSG_H_*/
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "OpenFileMsg.h"
|
||||
|
||||
|
||||
const struct NetMessageOps OpenFileMsg_Ops = {
|
||||
.serializePayload = OpenFileMsg_serializePayload,
|
||||
.deserializePayload = _NetMessage_deserializeDummy,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
.supportsSequenceNumbers = true,
|
||||
};
|
||||
|
||||
void OpenFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
|
||||
{
|
||||
OpenFileMsg* thisCast = (OpenFileMsg*)this;
|
||||
|
||||
// clientNumID
|
||||
NumNodeID_serialize(ctx, &thisCast->clientNumID);
|
||||
|
||||
// accessFlags
|
||||
Serialization_serializeUInt(ctx, thisCast->accessFlags);
|
||||
|
||||
// entryInfo
|
||||
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
|
||||
|
||||
if (this->msgHeader.msgFeatureFlags & OPENFILEMSG_FLAG_HAS_EVENT)
|
||||
FileEvent_serialize(ctx, thisCast->fileEvent);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
#ifndef OPENFILEMSG_H_
|
||||
#define OPENFILEMSG_H_
|
||||
|
||||
#include <common/storage/EntryInfo.h>
|
||||
#include <common/storage/FileEvent.h>
|
||||
#include <common/net/message/NetMessage.h>
|
||||
|
||||
|
||||
#define OPENFILEMSG_FLAG_USE_QUOTA 1 /* if the message contains quota informations */
|
||||
#define OPENFILEMSG_FLAG_HAS_EVENT 2 /* contains file event logging information */
|
||||
#define OPENFILEMSG_FLAG_BYPASS_ACCESS_CHECK 4 /* bypass file access checks on metadata server */
|
||||
|
||||
struct OpenFileMsg;
|
||||
typedef struct OpenFileMsg OpenFileMsg;
|
||||
|
||||
static inline void OpenFileMsg_init(OpenFileMsg* this);
|
||||
static inline void OpenFileMsg_initFromSession(OpenFileMsg* this,
|
||||
NumNodeID clientNumID, const EntryInfo* entryInfo, unsigned accessFlags,
|
||||
const struct FileEvent* fileEvent);
|
||||
|
||||
// virtual functions
|
||||
extern void OpenFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
|
||||
|
||||
|
||||
struct OpenFileMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
NumNodeID clientNumID;
|
||||
unsigned sessionIDLen;
|
||||
const EntryInfo* entryInfoPtr; // not owned by this object
|
||||
unsigned accessFlags;
|
||||
const struct FileEvent* fileEvent;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps OpenFileMsg_Ops;
|
||||
|
||||
void OpenFileMsg_init(OpenFileMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_OpenFile, &OpenFileMsg_Ops);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sessionID just a reference, so do not free it as long as you use this object!
|
||||
* @param entryInfoPtr just a reference, so do not free it as long as you use this object!
|
||||
* @param accessFlags OPENFILE_ACCESS_... flags
|
||||
*/
|
||||
void OpenFileMsg_initFromSession(OpenFileMsg* this,
|
||||
NumNodeID clientNumID, const EntryInfo* entryInfo, unsigned accessFlags,
|
||||
const struct FileEvent* fileEvent)
|
||||
{
|
||||
OpenFileMsg_init(this);
|
||||
|
||||
this->clientNumID = clientNumID;
|
||||
|
||||
this->entryInfoPtr = entryInfo;
|
||||
|
||||
this->accessFlags = accessFlags;
|
||||
this->fileEvent = fileEvent;
|
||||
|
||||
if (fileEvent)
|
||||
this->netMessage.msgHeader.msgFeatureFlags |= OPENFILEMSG_FLAG_HAS_EVENT;
|
||||
}
|
||||
|
||||
#endif /*OPENFILEMSG_H_*/
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "OpenFileRespMsg.h"
|
||||
|
||||
|
||||
const struct NetMessageOps OpenFileRespMsg_Ops = {
|
||||
.serializePayload = _NetMessage_serializeDummy,
|
||||
.deserializePayload = OpenFileRespMsg_deserializePayload,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
};
|
||||
|
||||
bool OpenFileRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
|
||||
{
|
||||
OpenFileRespMsg* thisCast = (OpenFileRespMsg*)this;
|
||||
|
||||
// result
|
||||
if(!Serialization_deserializeInt(ctx, &thisCast->result) )
|
||||
return false;
|
||||
|
||||
// fileHandleID
|
||||
if(!Serialization_deserializeStrAlign4(ctx, &thisCast->fileHandleIDLen,
|
||||
&thisCast->fileHandleID) )
|
||||
return false;
|
||||
|
||||
// pathInfo
|
||||
if (!PathInfo_deserialize(ctx, &thisCast->pathInfo) )
|
||||
return false;
|
||||
|
||||
// stripePattern
|
||||
if(!StripePattern_deserializePatternPreprocess(ctx,
|
||||
&thisCast->patternStart, &thisCast->patternLength) )
|
||||
return false;
|
||||
|
||||
if (!Serialization_deserializeUInt(ctx, &thisCast->fileVersion))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
#ifndef OPENFILERESPMSG_H_
|
||||
#define OPENFILERESPMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/storage/PathInfo.h>
|
||||
#include <common/storage/striping/StripePattern.h>
|
||||
#include <common/Common.h>
|
||||
|
||||
|
||||
struct OpenFileRespMsg;
|
||||
typedef struct OpenFileRespMsg OpenFileRespMsg;
|
||||
|
||||
static inline void OpenFileRespMsg_init(OpenFileRespMsg* this);
|
||||
|
||||
// virtual functions
|
||||
extern bool OpenFileRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx);
|
||||
|
||||
// inliners
|
||||
static inline StripePattern* OpenFileRespMsg_createPattern(OpenFileRespMsg* this);
|
||||
|
||||
// getters & setters
|
||||
static inline int OpenFileRespMsg_getResult(OpenFileRespMsg* this);
|
||||
static inline const char* OpenFileRespMsg_getFileHandleID(OpenFileRespMsg* this);
|
||||
static inline const PathInfo* OpenFileRespMsg_getPathInfo(OpenFileRespMsg* this);
|
||||
|
||||
struct OpenFileRespMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
int result;
|
||||
unsigned fileHandleIDLen;
|
||||
const char* fileHandleID;
|
||||
|
||||
PathInfo pathInfo;
|
||||
|
||||
uint32_t fileVersion;
|
||||
|
||||
// for serialization
|
||||
StripePattern* pattern; // not owned by this object!
|
||||
|
||||
// for deserialization
|
||||
const char* patternStart;
|
||||
uint32_t patternLength;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps OpenFileRespMsg_Ops;
|
||||
|
||||
void OpenFileRespMsg_init(OpenFileRespMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_OpenFileResp, &OpenFileRespMsg_Ops);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return must be deleted by the caller; might be of type STRIPEPATTERN_Invalid
|
||||
*/
|
||||
StripePattern* OpenFileRespMsg_createPattern(OpenFileRespMsg* this)
|
||||
{
|
||||
return StripePattern_createFromBuf(this->patternStart, this->patternLength);
|
||||
}
|
||||
|
||||
int OpenFileRespMsg_getResult(OpenFileRespMsg* this)
|
||||
{
|
||||
return this->result;
|
||||
}
|
||||
|
||||
const char* OpenFileRespMsg_getFileHandleID(OpenFileRespMsg* this)
|
||||
{
|
||||
return this->fileHandleID;
|
||||
}
|
||||
|
||||
const PathInfo* OpenFileRespMsg_getPathInfo(OpenFileRespMsg* this)
|
||||
{
|
||||
return &this->pathInfo;
|
||||
}
|
||||
|
||||
#endif /*OPENFILERESPMSG_H_*/
|
||||
Reference in New Issue
Block a user