41 if (!shMat) {errno = ENOTCONN;
return false;}
45 int hash = (hashFunc ? hashFunc(key) : 0);
49 return shMat->AddItem(&val, 0, key, hash,
false);
61 static const int waitSec = 2;
63 int rc, tries= (tmo < 0 ? 120 : (tmo < 4 ? tmo : tmo/waitSec));
68 if (shMat) {errno = EISCONN;
return false;}
72 newParms.
impl = implID;
75 newParms.
typeSz =
sizeof(T);
76 newParms.
hashID = (hashFunc ? hashFunc(0) : 0);
81 if (!shMat)
return false;
87 do {
if (shMat->Attach(tmo, isRW))
return true;
88 if (errno != EAGAIN)
break;
89 if (tries--) sleep(waitSec);
91 if (tries) errno = ECANCELED;
96 delete shMat; shMat = 0;
114 if (shMat) {errno = EISCONN;
return false;}
118 newParms.
impl = implID;
119 newParms.
path = path;
121 newParms.
typeSz =
sizeof(T);
122 newParms.
hashID = (hashFunc ? hashFunc(0) : 0);
127 if (!shMat)
return false;
142 if (shMat->Create(crzParms))
return true;
147 delete shMat; shMat = 0;
161 if (!shMat) {errno = ENOTCONN;
return false;}
165 int hash = (hashFunc ? hashFunc(key) : 0);
169 return shMat->DelItem(valP, key, hash);
181 if (shMat) {
delete shMat; shMat = 0;}
193 if (!shMat) {errno = ENOTCONN;
return false;}
197 return shMat->Enumerate(jar, key, (
void *&)val);
207 if (!shMat) {errno = ENOTCONN;
return false;}
211 return shMat->Enumerate(jar);
223 if (!shMat) {errno = ENOTCONN;
return false;}
227 int hash = (hashFunc ? hashFunc(key) : 0);
231 return shMat->GetItem(0, key, hash);
243 if (!shMat) {errno = ENOTCONN;
return false;}
247 return shMat->Export();
259 if (!shMat) {errno = ENOTCONN;
return false;}
263 int hash = (hashFunc ? hashFunc(key) : 0);
267 return shMat->GetItem(&val, key, hash);
279 if (!shMat) {errno = ENOTCONN;
return -1;}
283 return shMat->Info(vname, buff, blen);
295 if (!shMat) {errno = ENOTCONN;
return false;}
299 int hash = (hashFunc ? hashFunc(key) : 0);
303 return shMat->AddItem(&val, valP, key, hash,
true);
318 if (!shMat) {errno = ENOTCONN;
return false;}
337 return shMat->Resize(crzParms);
349 if (!shMat) {errno = ENOTCONN;
return false;}
354 {
case SyncOff:
return shMat->Sync(
false,
false);
356 case SyncOn:
return shMat->Sync(
true,
false);
358 case SyncAll:
return shMat->Sync(
true,
true);
360 case SyncNow:
return shMat->Sync();
362 case SyncQSz:
return shMat->Sync(syncqsz);
364 default: errno = EINVAL;
return false;
int access(const char *path, int amode)
const char * typeID
The name of the type associated with the key.
const char * impl
Implementation name.
static XrdSsiShMat * New(NewParms &parms)
const char * path
The path to the backing file for the table.
int hashID
The hash being used (0 means the default)
int typeSz
Size of the type in bytes.
void Detach()
Detach the map from the shared memory.
bool Del(const char *key, T *valP=0)
bool Get(const char *key, T &val)
bool Attach(const char *path, ShMap_Access access, int tmo=-1)
bool Enumerate(void *&jar, char *&key, T *&val)
bool Rep(const char *key, T &val, T *valP=0)
bool Sync(SyncOpt dosync, int syncqsz=256)
bool Create(const char *path, ShMap_Parms &parms)
bool Exists(const char *key)
int Info(const char *vname, char *buff=0, int blen=0)
bool Add(const char *key, T &val)
bool Resize(ShMap_Parms *parms=0)
ShMap_Access
The action parameter that must be passed to the Attach() method.
SyncOpt
Options valid for the Sync() method.
int maxKeys
Maximum number of keys-value pairs expected in table.
int maxKLen
The maximum acceptable key length.
int mode
Filemode for the newly created file.
int indexSz
Number of four byte hash table entries to create.
static const int MultW
Bit options that may be or'd into he options member above.
int maxKeys
Maximum expected keys.
int mode
Mode setting for the newly created file.
int maxKeyLen
Maximum key length.
static const int ReUse
Reuse map storage.
static const int ForResize
Constructor suitable for Resize() (use ShMap_Parms(ForResize)).
int options
Bit or'd ShMop_xxxx options below.
int indexSize
Number of hash table entries to create.