Skip to content

Commit

Permalink
Merge branch 'master' of github.com:aerospike/aerospike-tools-backup …
Browse files Browse the repository at this point in the history
…into tools-2788
  • Loading branch information
dwelch-spike committed Dec 6, 2023
2 parents 9a612e4 + 63edc6d commit 3bd251a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -352,16 +352,16 @@ all: $(BINS)
# used as a pre-requisite for make shared
# this rule is not meant for manual use by a user
.PHONY: _set_dynamic_options
_set_dynamic_options: $(TOML)
_set_dynamic_options:
$(eval CFLAGS += -DASB_SHARED_LIB)
$(eval DYNAMIC_OPTIONS = -fPIC)

# builds asbackup and asrestore as shared libraries
# asbackup is designed as a standalone exe, use at your own risk
# run this with the same options you would use in a normal build
.PHONY: shared
shared: _set_dynamic_options $(BACKUP_DYNAMIC) $(RESTORE_DYNAMIC)
$(eval DYNAMIC_OPTIONS =)
shared: _set_dynamic_options $(TOML) $(BACKUP_DYNAMIC) $(RESTORE_DYNAMIC)
$(eval DYNAMIC_OPTIONS =)

.PHONY: clean
clean:
Expand Down Expand Up @@ -430,7 +430,7 @@ $(RESTORE_DYNAMIC): $(RESTORE_OBJ) $(TOML) $(C_CLIENT_LIB) $(SECRET_CLIENT_LIB)
$(CXX) $(DYNAMIC_FLAG) $(LDFLAGS) -o $(RESTORE_DYNAMIC) $(RESTORE_OBJ) $(LIBRARIES)

$(TOML):
$(MAKE) -C $(DIR_TOML)
$(MAKE) -C $(DIR_TOML) CFLAGS=$(DYNAMIC_OPTIONS)

$(C_CLIENT_LIB):
$(MAKE) -C $(DIR_C_CLIENT) EVENT_LIB=$(EVENT_LIB)
Expand Down
5 changes: 5 additions & 0 deletions include/file_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ void s3_set_log_level(s3_log_level_t log_level);
*/
void s3_disable_request_processing();

/*
* Indicates whether the global S3 API is initialized.
*/
bool s3_initialized();

/*
* Must be called just before exit, shuts down and cleans up all cloud API
* instances.
Expand Down
6 changes: 5 additions & 1 deletion src/backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -2597,6 +2597,10 @@ no_op(int32_t sig)
static void
set_s3_configs(const backup_config_t* conf)
{
if (s3_initialized()) {
return;
}

if (conf->s3_region != NULL) {
s3_set_region(conf->s3_region);
}
Expand All @@ -2613,4 +2617,4 @@ set_s3_configs(const backup_config_t* conf)
s3_set_max_async_uploads(conf->s3_max_async_uploads);
s3_set_connect_timeout_ms(conf->s3_connect_timeout);
s3_set_log_level(conf->s3_log_level);
}
}
7 changes: 6 additions & 1 deletion src/file_proxy_s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

extern "C" {

bool s3_initialized();
void file_proxy_s3_shutdown();

bool s3_delete_object(const char* file_path);
Expand Down Expand Up @@ -131,6 +132,11 @@ s3_parse_log_level(const char* log_level_str, s3_log_level_t* log_level)
return false;
}

bool
s3_initialized() {
return g_api.IsInitialized();
}

/*
* Closes the S3 API. Must be called just before the program exits.
*/
Expand Down Expand Up @@ -977,4 +983,3 @@ _calc_part_size(uint64_t max_file_size)
uint64_t part_size = (max_file_size + S3_MAX_N_PARTS - 1) / S3_MAX_N_PARTS;
return part_size < S3_MIN_PART_SIZE ? S3_MIN_PART_SIZE : part_size;
}

0 comments on commit 3bd251a

Please sign in to comment.