forked from open-power/snap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction_hashjoin.h
85 lines (69 loc) · 2.42 KB
/
action_hashjoin.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef __ACTION_HASHJOIN_H__
#define __ACTION_HASHJOIN_H__
/*
* Copyright 2017, International Business Machines
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <snap_types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define HASHJOIN_ACTION_TYPE 0x10141002
#define RELEASE_LEVEL 0x00000020
#define TABLE1_SIZE 32
#define TABLE2_SIZE 32
#define TABLE3_SIZE (TABLE1_SIZE * TABLE2_SIZE)
#define HT_SIZE (TABLE1_SIZE * 16) /* size of hashtable */
#define HT_MULTI (TABLE1_SIZE) /* multihash entries depends on table1 */
typedef char hashkey_t[64];
typedef char hashdata_t[256];
/* FIXME Make tables entry size a multiple of 64 bytes */
#define HASHJOIN_ALIGN 128
typedef struct table1_s {
hashkey_t name; /* 64 bytes */
uint32_t age; /* 4 bytes */
uint8_t reserved[60]; /* 60 bytes */
} table1_t;
typedef struct table2_s {
hashkey_t name; /* 64 bytes */
hashkey_t animal; /* 64 bytes */
} table2_t;
typedef struct table3_s {
hashkey_t animal; /* 64 bytes */
hashkey_t name; /* 64 bytes */
uint32_t age; /* 4 bytes */
uint8_t reserved[60]; /* 60 bytes */
} table3_t;
typedef struct entry_s {
hashkey_t key; /* key */
unsigned int used; /* list entries used */
table1_t multi[HT_MULTI];/* fixed size */
} entry_t;
typedef struct hashtable_s {
entry_t table[HT_SIZE]; /* fixed size */
} hashtable_t;
typedef struct hashjoin_job {
struct snap_addr t1; /* IN: input table1 for multihash */
struct snap_addr t2; /* IN: 2nd table2 to do join with */
struct snap_addr t3; /* OUT: resulting table3 */
struct snap_addr hashtable; /* CACHE: multihash table */
uint64_t t1_processed; /* #entries cached, repeat if not all */
uint64_t t2_processed; /* #entries processed, repeat if not all */
uint64_t t3_produced; /* #entries produced store them away */
uint64_t checkpoint;
} hashjoin_job_t;
#ifdef __cplusplus
}
#endif
#endif /* __ACTION_HASHJOIN_H__ */