summaryrefslogtreecommitdiff
path: root/example/single_thread.cpp
blob: fe584e2f8bf5705ae8fbe2437e1ae93e55e505ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*************************************************************************
    > File Name: single_thread.cpp
    > Author: pxz
    > Created Time: Fri 11 Sep 2020 09:52:05 AM CST
 ************************************************************************/
#include<stdio.h>
#include<unistd.h>
#include"../src/hos_client.h"

int main(int argc, char *argv[])
{
    char *bucket = argv[1];
    printf("hos_client_init start ...\n");
    hos_client_handle handle = hos_client_init("http://192.168.44.12:9098/hos", "default", "default");
    if (handle == NULL) 
    {
        printf("error:hos_client_handle\n");
        return -1;
    }  
    printf("hos_client_init success ...");

    printf("hos_create_bucket start ... \n");
    if(!hos_create_bucket(handle, bucket))
    {
        printf("hos_create_bucket failed ... \n");
    }
    printf("hos_create_bucket success ... \n");

    printf("hos_upload_async start ...\n");
    hos_upload_async(handle, bucket, "my-file.txt");
    
    //sleep(30);
    hos_client_close(handle);

    return 0;
}