Skip to content

Commit

Permalink
rocksdb: remove MacOS-specific options (#53)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #53

No need to keep a copy of MacOS-specific options.go just to have `ulong` replaced with `ulonglong`. Use universal `size_t` and `uint64_t` instead

Reviewed By: deathowl

Differential Revision: D51027976

fbshipit-source-id: 13c9142b5263805d5f3b4311b142badb5c27f86e
  • Loading branch information
abulimov authored and facebook-github-bot committed Nov 6, 2023
1 parent f5723c5 commit 2da5c5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 449 deletions.
20 changes: 7 additions & 13 deletions dnsrocks/cgo-rocksdb/options.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build !darwin
// +build !darwin

/*
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -115,12 +112,12 @@ func (options *Options) EnableCreateIfMissing() {
// process will still get automatically delete on every compaction,
// regardless of this setting
func (options *Options) SetDeleteObsoleteFilesPeriodMicros(micros uint) {
C.rocksdb_options_set_delete_obsolete_files_period_micros(options.cOptions, C.ulong(micros))
C.rocksdb_options_set_delete_obsolete_files_period_micros(options.cOptions, C.uint64_t(micros))
}

// SetKeepLogFileNum sets maximal info log files to be kept.
func (options *Options) SetKeepLogFileNum(num uint) {
C.rocksdb_options_set_keep_log_file_num(options.cOptions, C.ulong(num))
C.rocksdb_options_set_keep_log_file_num(options.cOptions, C.size_t(num))
}

// EnableErrorIfExists flags that an existing database is not expected and opening it should not succeed.
Expand Down Expand Up @@ -264,7 +261,7 @@ func (options *Options) SetMaxWriteBufferNumber(num int) {
func (options *Options) SetWriteBufferSize(size int) {
C.rocksdb_options_set_write_buffer_size(
options.cOptions,
C.ulong(size),
C.size_t(size),
)
}

Expand All @@ -276,7 +273,7 @@ func (options *Options) SetWriteBufferSize(size int) {
func (options *Options) SetTargetFileSizeBase(size int) {
C.rocksdb_options_set_target_file_size_base(
options.cOptions,
C.ulong(size),
C.uint64_t(size),
)
}

Expand All @@ -286,7 +283,7 @@ func (options *Options) SetTargetFileSizeBase(size int) {
func (options *Options) SetMaxBytesForLevelBase(size int) {
C.rocksdb_options_set_max_bytes_for_level_base(
options.cOptions,
C.ulong(size),
C.uint64_t(size),
)
}

Expand Down Expand Up @@ -432,11 +429,8 @@ func NewDefaultReadOptions() *ReadOptions {

// NewReadOptions creates ReadOptions object
// Parameters:
// - verifyChecksum: all data read from underlying storage will be
// verified against corresponding checksums
// - fillCache: Should the "data block"/"index block"" read for this
//
// iteration be placed in block cache?
// - verifyChecksum: all data read from underlying storage will be verified against corresponding checksums
// - fillCache: Should the "data block"/"index block"" read for this iteration be placed in block cache?
func NewReadOptions(verifyChecksum, fillCache bool) *ReadOptions {
readOptions := NewDefaultReadOptions()
cReadOptions := readOptions.cReadOptions
Expand Down
Loading

0 comments on commit 2da5c5b

Please sign in to comment.