Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
e29feb2a
Commit
e29feb2a
authored
9 years ago
by
David Garcia Quintas
Browse files
Options
Downloads
Patches
Plain Diff
Introduced compression levels as an abstraction for the actual algorithm.
parent
0d6cf992
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/grpc/compression.h
+13
-0
13 additions, 0 deletions
include/grpc/compression.h
src/core/compression/algorithm.c
+19
-0
19 additions, 0 deletions
src/core/compression/algorithm.c
with
32 additions
and
0 deletions
include/grpc/compression.h
+
13
−
0
View file @
e29feb2a
...
@@ -34,6 +34,9 @@
...
@@ -34,6 +34,9 @@
#ifndef GRPC_COMPRESSION_H
#ifndef GRPC_COMPRESSION_H
#define GRPC_COMPRESSION_H
#define GRPC_COMPRESSION_H
/** To be used in channel arguments */
#define GRPC_COMPRESSION_LEVEL_ARG "grpc.compression_level"
/* The various compression algorithms supported by GRPC */
/* The various compression algorithms supported by GRPC */
typedef
enum
{
typedef
enum
{
GRPC_COMPRESS_NONE
=
0
,
GRPC_COMPRESS_NONE
=
0
,
...
@@ -43,7 +46,17 @@ typedef enum {
...
@@ -43,7 +46,17 @@ typedef enum {
GRPC_COMPRESS_ALGORITHMS_COUNT
GRPC_COMPRESS_ALGORITHMS_COUNT
}
grpc_compression_algorithm
;
}
grpc_compression_algorithm
;
typedef
enum
{
GRPC_COMPRESS_LEVEL_NONE
=
0
,
GRPC_COMPRESS_LEVEL_LOW
,
GRPC_COMPRESS_LEVEL_MED
,
GRPC_COMPRESS_LEVEL_HIGH
}
grpc_compression_level
;
const
char
*
grpc_compression_algorithm_name
(
const
char
*
grpc_compression_algorithm_name
(
grpc_compression_algorithm
algorithm
);
grpc_compression_algorithm
algorithm
);
grpc_compression_algorithm
grpc_compression_algorithm_for_level
(
grpc_compression_level
level
);
#endif
/* GRPC_COMPRESSION_H */
#endif
/* GRPC_COMPRESSION_H */
This diff is collapsed.
Click to expand it.
src/core/compression/algorithm.c
+
19
−
0
View file @
e29feb2a
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
*
*
*/
*/
#include
<stdlib.h>
#include
<grpc/compression.h>
#include
<grpc/compression.h>
const
char
*
grpc_compression_algorithm_name
(
const
char
*
grpc_compression_algorithm_name
(
...
@@ -47,3 +48,21 @@ const char *grpc_compression_algorithm_name(
...
@@ -47,3 +48,21 @@ const char *grpc_compression_algorithm_name(
}
}
return
"error"
;
return
"error"
;
}
}
/* TODO(dgq): Add the ability to specify parameters to the individual
* compression algorithms */
grpc_compression_algorithm
grpc_compression_algorithm_for_level
(
grpc_compression_level
level
)
{
switch
(
level
)
{
case
GRPC_COMPRESS_NONE
:
return
GRPC_COMPRESS_NONE
;
case
GRPC_COMPRESS_LEVEL_LOW
:
case
GRPC_COMPRESS_LEVEL_MED
:
return
GRPC_COMPRESS_DEFLATE
;
case
GRPC_COMPRESS_LEVEL_HIGH
:
return
GRPC_COMPRESS_GZIP
;
default:
/* we shouldn't be making it here */
abort
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment