Example #1
0
void bgrewriteaofCommand(redisClient *c) {
    if (server.aof_child_pid != -1) {
        addReplyError(c,"Background append only file rewriting already in progress");
    } else if (server.rdb_child_pid != -1) {
        server.aof_rewrite_scheduled = 1;
        addReplyStatus(c,"Background append only file rewriting scheduled");
    } else if (rewriteAppendOnlyFileBackground() == REDIS_OK) {
        addReplyStatus(c,"Background append only file rewriting started");
    } else {
        addReply(c,shared.err);
    }
}
Example #2
0
void LengthenDelay(client *c, int argc, sds *argv)
{
	int ret= Lengthen(argv[1]);

	if(ret==0) addReplyStatus(c, "+OK");
	else addReplyError(c, tubii_err);
}
Example #3
0
void countReset(client *c, int argc, sds *argv)
{
  uint32_t reset;
  safe_strtoul(argv[1],&reset);
  counterReset(reset);
  addReplyStatus(c, "+OK");
}
Example #4
0
/* Output the representation of a Redis command. Used by the COMMAND command. */
static void addReplyCommand(client *c, struct redisCommand *cmd) {
    if (!cmd) {
        addReply(c, shared.nullbulk);
    } else {
        /* We are adding: command name, arg count, flags, first, last, offset */
        addReplyMultiBulkLen(c, 6);
        addReplyBulkCString(c, cmd->name);
        addReplyLongLong(c, cmd->arity);

        int flagcount = 0;
        void *flaglen = addDeferredMultiBulkLength(c);
        flagcount += addReplyCommandFlag(c,cmd,CMD_WRITE, "write");
        flagcount += addReplyCommandFlag(c,cmd,CMD_READONLY, "readonly");
        flagcount += addReplyCommandFlag(c,cmd,CMD_DENYOOM, "denyoom");
        flagcount += addReplyCommandFlag(c,cmd,CMD_ADMIN, "admin");
        flagcount += addReplyCommandFlag(c,cmd,CMD_PUBSUB, "pubsub");
        flagcount += addReplyCommandFlag(c,cmd,CMD_NOSCRIPT, "noscript");
        flagcount += addReplyCommandFlag(c,cmd,CMD_RANDOM, "random");
        flagcount += addReplyCommandFlag(c,cmd,CMD_SORT_FOR_SCRIPT,"sort_for_script");
        flagcount += addReplyCommandFlag(c,cmd,CMD_LOADING, "loading");
        flagcount += addReplyCommandFlag(c,cmd,CMD_STALE, "stale");
        flagcount += addReplyCommandFlag(c,cmd,CMD_SKIP_MONITOR, "skip_monitor");
        flagcount += addReplyCommandFlag(c,cmd,CMD_ASKING, "asking");
        flagcount += addReplyCommandFlag(c,cmd,CMD_FAST, "fast");
        if (cmd->getkeys_proc) {
            addReplyStatus(c, "movablekeys");
            flagcount += 1;
        }
        setDeferredMultiBulkLength(c, flaglen, flagcount);

        addReplyLongLong(c, cmd->firstkey);
        addReplyLongLong(c, cmd->lastkey);
        addReplyLongLong(c, cmd->keystep);
    }
}
Example #5
0
// Trigger Commands
void countLatch(client *c, int argc, sds *argv)
{
  uint32_t latch;
  safe_strtoul(argv[1],&latch);
  counterLatch(latch);
  addReplyStatus(c, "+OK");
}
Example #6
0
void SetSpeakerMask(client *c, int argc, sds *argv)
{
  uint32_t mask;
  safe_strtoul(argv[1],&mask);
  speakerMask(mask);
  addReplyStatus(c, "+OK");
}
Example #7
0
void SetAllowableClockMisses(client *c, int argc, sds *argv)
{
  uint32_t nMisses;
  safe_strtoul(argv[1],&nMisses);
  ClockMisses(nMisses);
  addReplyStatus(c, "+OK");
}
Example #8
0
void SetSpeakerScale(client *c, int argc, sds *argv)
{
  uint32_t rate;
  safe_strtoul(argv[1],&rate);
  speakerScale(rate);
  addReplyStatus(c, "+OK");
}
Example #9
0
void countMode(client *c, int argc, sds *argv)
{
  uint32_t mode;
  safe_strtoul(argv[1],&mode);
  counterMode(mode);
  addReplyStatus(c, "+OK");
}
Example #10
0
void typeCommand(redisClient *c) {
    robj *o;
    char *type;

    o = lookupKeyRead(c->db,c->argv[1]);
    if (o == NULL) {
        type = "none";
    } else {
        switch(o->type) {
        case REDIS_STRING:
            type = "string";
            break;
        case REDIS_LIST:
            type = "list";
            break;
        case REDIS_SET:
            type = "set";
            break;
        case REDIS_ZSET:
            type = "zset";
            break;
        case REDIS_HASH:
            type = "hash";
            break;
        default:
            type = "unknown";
            break;
        }
    }
    addReplyStatus(c,type);
}
Example #11
0
// DAC Settings
void SetDACThreshold(client *c, int argc, sds *argv)
{
  uint32_t dacThresh;
  safe_strtoul(argv[1],&dacThresh);
  DACThresholds(dacThresh);
  addReplyStatus(c, "+OK");
}
Example #12
0
/* Helper function for addReplyCommand() to output flags. */
static int addReplyCommandFlag(client *c, struct redisCommand *cmd, int f, char *reply) {
    if (cmd->flags & f) {
        addReplyStatus(c, reply);
        return 1;
    }
    return 0;
}
Example #13
0
// Control register
void SetControlReg(client *c, int argc, sds *argv)
{
  uint32_t cReg;
  safe_strtoul(argv[1],&cReg);
  ControlReg(cReg);
  addReplyStatus(c, "+OK");
}
Example #14
0
void SetTriggerMask(client *c, int argc, sds *argv)
{
  uint32_t mask, mask_async;
  safe_strtoul(argv[1],&mask);
  safe_strtoul(argv[2],&mask_async);
  triggerMask(mask,mask_async);
  addReplyStatus(c, "+OK");
}
Example #15
0
// DGT & LO
void SetGTDelays(client *c, int argc, sds *argv)
{
  uint32_t loDelay, dgtDelay;
  safe_strtoul(argv[1],&loDelay);
  safe_strtoul(argv[2],&dgtDelay);
  GTDelays(loDelay, dgtDelay);
  addReplyStatus(c, "+OK");
}
Example #16
0
// CAEN Settings
void SetCaenWords(client *c, int argc, sds *argv)
{
  uint32_t gPath, cSelect;
  safe_strtoul(argv[1],&gPath);
  safe_strtoul(argv[2],&cSelect);
  CAENWords(gPath, cSelect);
  addReplyStatus(c, "+OK");
}
Example #17
0
// Utility commands
void MZHappy(client *c, int argc, sds *argv)
{
  // Set for 1e9 pulses. Should renew this in the status readout.
  int ret= Pulser(1,0.5,1e9,MappedHappyBaseAddress);

  if(ret == 0) addReplyStatus(c, "+OK");
  else addReplyError(c, tubii_err);
}
Example #18
0
void SetComboTrigger(client *c, int argc, sds *argv)
{
  u32 enableMask, logicMask;
  safe_strtoul(argv[1],&enableMask);
  safe_strtoul(argv[2],&logicMask);

  if(comboTrig(enableMask,logicMask) == 0) addReplyStatus(c, "+OK");
  else addReplyError(c, tubii_err);
}
Example #19
0
//// Shift Register commands
//   Low level stuff
void dataready(client *c, int argc, sds *argv)
{
  uint32_t dReady;
  safe_strtoul(argv[1],&dReady);
  int ret= DataReady(dReady);

  if(ret==0) addReplyStatus(c, "+OK");
  else addReplyError(c, tubii_err);
}
Example #20
0
void muxer(client *c, int argc, sds *argv)
{
  uint32_t mux;
  safe_strtoul(argv[1],&mux);
  int ret= Muxer(mux);

  if(ret == 0) addReplyStatus(c, "+OK");
  else addReplyError(c, tubii_err);
}
Example #21
0
// Clock commands
void clockreset(client *c, int argc, sds *argv)
{
  int ret= clockReset(1);
  usleep(1000);
  ret= clockReset(0);

  if(ret != 0) addReplyError(c, tubii_err);
  else addReplyStatus(c, "+OK");
}
Example #22
0
void loadShift(client *c, int argc, sds *argv)
{
  uint32_t lShift;
  safe_strtoul(argv[1],&lShift);
  int ret= LoadShift(lShift);

  if(ret == 0) addReplyStatus(c, "+OK");
  else addReplyError(c, tubii_err);
}
Example #23
0
void gtdelay(client *c, int argc, sds *argv)
{
  float length=0;
  safe_strtof(argv[1],&length);
  u32 delay = length*ns;
  int ret= Delay(delay,MappedGTDelayBaseAddress);

  if(ret == 0) addReplyStatus(c, "+OK");
  else addReplyError(c, tubii_err);
}
Example #24
0
void SetPrescaleTrigger(client *c, int argc, sds *argv)
{
  float rate;
  uint32_t bit;
  safe_strtof(argv[1],&rate);
  safe_strtoul(argv[2],&bit);

  if(prescaleTrig(rate,bit) == 0) addReplyStatus(c, "+OK");
  else addReplyError(c, tubii_err);
}
Example #25
0
// Initialisation functions
void initialise(client *c, int argc, sds *argv)
{
  // Calls auto_init which:
  //  -Maps all the memory
  //  -Sets registers
  auto_init();

  // Need to check for errors
  addReplyStatus(c, "+OK");
}
Example #26
0
void bgsaveCommand(redisClient *c) {
    if (server.bgsavechildpid != -1) {
        addReplyError(c,"Background save already in progress");
    } else if (server.bgrewritechildpid != -1) {
        addReplyError(c,"Can't BGSAVE while AOF log rewriting is in progress");
    } else if (rdbSaveBackground(server.dbfilename) == REDIS_OK) {
        addReplyStatus(c,"Background saving started");
    } else {
        addReply(c,shared.err);
    }
}
Example #27
0
void bgrewriteaofCommand(redisClient *c) {
    if (server.bgrewritechildpid != -1) {
        addReplyError(c,"Background append only file rewriting already in progress");
        return;
    }
    if (rewriteAppendOnlyFileBackground() == REDIS_OK) {
        addReplyStatus(c,"Background append only file rewriting started");
    } else {
        addReply(c,shared.err);
    }
}
Example #28
0
void bgsaveCommand(redisClient *c) {
    if (server.bgsavechildpid != -1) {
        addReplyError(c,"Background save already in progress");
        return;
    }
    if (rdbSaveBackground(server.dbfilename) == REDIS_OK) {
        addReplyStatus(c,"Background saving started");
    } else {
        addReply(c,shared.err);
    }
}
Example #29
0
void SetECalBit(client *c, int argc, sds *argv)
{
  uint32_t cReg;
  safe_strtoul(argv[1],&cReg);
  if(cReg==1 || cReg==0){
	  ControlReg((mReadReg((u32) MappedRegsBaseAddress, RegOffset10) & 4294967291) + 4*cReg);
	  addReplyStatus(c, "+OK");
  }
  else{
	  addReplyError(c, "ECals can only be set on (1) or off (0).");
  }
}
Example #30
0
void SetTrigWordDelay(client *c, int argc, sds *argv)
{
  float length=0;
  safe_strtof(argv[1],&length);
  u32 delay = length*ns;

  int ret= TrigWordDelay(delay);
  if(ret!=0){
	addReplyError(c, tubii_err);
	return;
  }
  addReplyStatus(c, "+OK");
}