-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sstable/block: move Compression enum from sstable
Move the sstable.Compression enum into the sstable/block package.
- Loading branch information
Showing
19 changed files
with
122 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2024 The LevelDB-Go and Pebble Authors. All rights reserved. Use | ||
// of this source code is governed by a BSD-style license that can be found in | ||
// the LICENSE file. | ||
|
||
package block | ||
|
||
// Compression is the per-block compression algorithm to use. | ||
type Compression int | ||
|
||
// The available compression types. | ||
const ( | ||
DefaultCompression Compression = iota | ||
NoCompression | ||
SnappyCompression | ||
ZstdCompression | ||
NCompression | ||
) | ||
|
||
// String implements fmt.Stringer, returning a human-readable name for the | ||
// compression algorithm. | ||
func (c Compression) String() string { | ||
switch c { | ||
case DefaultCompression: | ||
return "Default" | ||
case NoCompression: | ||
return "NoCompression" | ||
case SnappyCompression: | ||
return "Snappy" | ||
case ZstdCompression: | ||
return "ZSTD" | ||
default: | ||
return "Unknown" | ||
} | ||
} | ||
|
||
// CompressionFromString returns an sstable.Compression from its | ||
// string representation. Inverse of c.String() above. | ||
func CompressionFromString(s string) Compression { | ||
switch s { | ||
case "Default": | ||
return DefaultCompression | ||
case "NoCompression": | ||
return NoCompression | ||
case "Snappy": | ||
return SnappyCompression | ||
case "ZSTD": | ||
return ZstdCompression | ||
default: | ||
return DefaultCompression | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.