Revision ef8002fd src/Tests/cloud_helper_delegate_file.c

View differences:

src/Tests/cloud_helper_delegate_file.c
14 14
  int (*get_from_cloud)(void *context, char *key, uint8_t *header_ptr, int header_size);
15 15
  int (*put_on_cloud)(void *context, char *key, uint8_t *buffer_ptr, int buffer_size);
16 16
  struct nodeID* (*get_cloud_node)(void *context);
17
  int (*is_cloud_node)(void *context, struct nodeID* node);
17 18
  int (*wait4cloud)(void *context, struct timeval *tout);
18 19
  int (*recv_from_cloud)(void *context, uint8_t *buffer_ptr, int buffer_size);
19 20
};
......
30 31
  struct mem_offset out_len[10];
31 32
  int out_cnt;
32 33
  int key_error;
34
  struct nodeID* cloud_node_base;
33 35
};
34 36

  
35 37

  
......
169 171
  sem_init(&ctx->sem, 0, 1);
170 172
  ctx->path = path;
171 173
  ctx->out_cnt = -1;
174
  ctx->cloud_node_base = create_node("0.0.0.0", 0);
172 175
  return ctx;
173 176
}
174 177

  
......
223 226

  
224 227
struct nodeID* file_cloud_get_cloud_node(void *context)
225 228
{
226
  return NULL;
229
  struct file_cloud_context *ctx;
230
  ctx = (struct file_cloud_context *)context;
231
  return ctx->cloud_node_base;
232
}
233

  
234
int file_cloud_is_cloud_node(void *context, struct nodeID* node)
235
{
236
  struct file_cloud_context *ctx;
237
  struct nodeID *candidate_node;
238
  int result = -1;
239
  ctx = (struct file_cloud_context *)context;
240
  candidate_node = create_node(node_ip(node), 0);
241

  
242
  result = nodeid_equal(ctx->cloud_node_base, candidate_node);
243
  nodeid_free(candidate_node);
244
  return result;
227 245
}
228 246

  
229 247
static int file_cloud_wait4cloud(void *context, struct timeval *tout)
......
283 301
  .get_from_cloud = &file_cloud_get_from_cloud,
284 302
  .put_on_cloud = &file_cloud_put_on_cloud,
285 303
  .get_cloud_node = &file_cloud_get_cloud_node,
304
  .is_cloud_node = &file_cloud_is_cloud_node,
286 305
  .wait4cloud = file_cloud_wait4cloud,
287 306
  .recv_from_cloud = file_cloud_recv_from_cloud
288 307
};

Also available in: Unified diff