Revision 47c95dd4

View differences:

src/Tests/cloud_helper_delegate_file.c
15 15

  
16 16
struct delegate_iface {
17 17
  void* (*cloud_helper_init)(struct nodeID *local, const char *config);
18
  int (*get_from_cloud)(void *context, char *key, uint8_t *header_ptr, int header_size);
19
  int (*put_on_cloud)(void *context, char *key, uint8_t *buffer_ptr, int buffer_size);
18
  int (*get_from_cloud)(void *context, const char *key, uint8_t *header_ptr,
19
                        int header_size, int free_header);
20
  int (*put_on_cloud)(void *context, const char *key, uint8_t *buffer_ptr,
21
                      int buffer_size, int free_buffer);
20 22
  struct nodeID* (*get_cloud_node)(void *context, uint8_t variant);
21 23
  time_t (*timestamp_cloud)(void *context);
22 24
  int (*is_cloud_node)(void *context, struct nodeID* node);
......
182 184
  return ctx;
183 185
}
184 186

  
185
static int file_cloud_get_from_cloud(void *context, char *key, uint8_t *header_ptr, int header_size)
187
static int file_cloud_get_from_cloud(void *context, const char *key,
188
                                     uint8_t *header_ptr, int header_size,
189
                                     int free_header)
186 190
{
187 191
  struct file_cloud_context *ctx;
188 192
  int err;
......
203 207
  return 0;
204 208
}
205 209

  
206
static int file_cloud_put_on_cloud(void *context, char *key, uint8_t *buffer_ptr, int buffer_size)
210
static int file_cloud_put_on_cloud(void *context, const char *key,
211
                                   uint8_t *buffer_ptr, int buffer_size,
212
                                   int free_buffer)
207 213
{
208 214
  struct file_cloud_context *ctx;
209 215
  struct gpThreadContext *tc;
src/Tests/cloud_test.c
133 133
  switch(operation) {
134 134
  case PUT:
135 135
    printf("Putting on cloud value \"%s\" for key \"%s\"\n", value, key);
136
    err = put_on_cloud(cloud, key, value, strlen(value));
136
    err = put_on_cloud(cloud, key, value, strlen(value), 0);
137 137
    if (err) {
138 138
      printf("Error performing the operation");
139 139
      return 1;
......
141 141
    break;
142 142
  case GET:
143 143
    printf("Getting from cloud value for key \"%s\": ", key);
144
    err = get_from_cloud(cloud, key, HEADER, strlen(HEADER));
144
    err = get_from_cloud(cloud, key, HEADER, strlen(HEADER), 0);
145 145
    if (err) {
146 146
      printf("Error performing the operation");
147 147
      return 1;
......
153 153
      if (err < 0) {
154 154
        printf("Erorr receiving cloud response\n");
155 155
        return 1;
156
      } else if (err == 0) {
157
        printf("Key not present on the cloud\n");
158 156
      } else {
159 157
        time_t timestamp;
160 158
        int i;
161 159
        buffer[err] = '\0';
162
        printf("len=%d\n", err, buffer);
160
        printf("len=%d\n", err);
163 161
        for (i=0; i<err; i++)
164 162
          printf("%x(%c) ", buffer[i], buffer[i]);
165 163
        printf("\n");
src/Tests/cloud_topology_monitor.c
86 86
  int cnt = 0;
87 87

  
88 88
  printf("Initializing the cloud...\n");
89
  put_on_cloud(con->cloud_context, CLOUD_VIEW_KEY, NULL, 0);
89
  put_on_cloud(con->cloud_context, CLOUD_VIEW_KEY, NULL, 0, 0);
90 90

  
91 91

  
92 92
  while (!done) {
......
103 103

  
104 104
    t1 = tout;
105 105
    sleep(5);
106
    err = get_from_cloud(con->cloud_context, CLOUD_VIEW_KEY, NULL, 0);
106
    err = get_from_cloud(con->cloud_context, CLOUD_VIEW_KEY, NULL, 0, 0);
107 107
    news = wait4cloud(con->cloud_context, &t1);
108 108
    if (news > 0) {
109 109
      len = recv_from_cloud(con->cloud_context, buff, BUFFSIZE);

Also available in: Unified diff