github.com/m3db/m3@v1.5.0/src/m3ninx/generated-source-files.mk (about) 1 SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST))) 2 include $(SELF_DIR)/../../.ci/common.mk 3 4 gopath_prefix := $(GOPATH)/src 5 m3ninx_package := github.com/m3db/m3/src/m3ninx 6 m3ninx_package_path := $(gopath_prefix)/$(m3ninx_package) 7 m3x_package := github.com/m3db/m3/src/x 8 m3x_package_path := $(gopath_prefix)/$(m3x_package) 9 10 # Generation rule for all generated types 11 .PHONY: genny-all 12 genny-all: genny-map-all genny-arraypool-all 13 14 # Map generation rule for all generated maps 15 .PHONY: genny-map-all 16 genny-map-all: \ 17 genny-map-segment-builder-postingsmap \ 18 genny-map-segment-builder-fieldsmap \ 19 genny-map-segment-builder-idsmap \ 20 genny-map-segment-mem-fieldsmap \ 21 22 # NB: We use (genny)[1] to combat the lack of generics in Go. It allows us 23 # to declare templat-ized versions of code, and specialize using code 24 # generation. We have a generic HashMap<K,V> implementation in `m3x`, 25 # with two template variables (KeyType and ValueType), along with required 26 # functors (HashFn, EqualsFn, ...). Below, we generate a few specialized 27 # versions required in m3ninx today. 28 # 29 # If we need to generate other specialized map implementations, or other 30 # specialized datastructures, we should add targets similar to the ones below. 31 # 32 # [1]: https://github.com/cheekybits/genny 33 34 # Map generation rule for index/segment/builder.PostingsMap 35 .PHONY: genny-map-segment-builder-postingsmap 36 genny-map-segment-builder-postingsmap: 37 cd $(m3x_package_path) && make byteshashmap-gen \ 38 pkg=builder \ 39 value_type=postings.MutableList \ 40 target_package=$(m3ninx_package)/index/segment/builder \ 41 rename_nogen_key=true \ 42 rename_nogen_value=true \ 43 rename_type_prefix=Postings \ 44 rename_constructor=NewPostingsMap \ 45 rename_constructor_options=PostingsMapOptions 46 # Rename generated map file 47 mv -f $(m3ninx_package_path)/index/segment/builder/map_gen.go $(m3ninx_package_path)/index/segment/builder/postings_map_gen.go 48 mv -f $(m3ninx_package_path)/index/segment/builder/new_map_gen.go $(m3ninx_package_path)/index/segment/builder/postings_map_new.go 49 50 # Map generation rule for index/segment/builder.IDsMap 51 .PHONY: genny-map-segment-builder-idsmap 52 genny-map-segment-builder-idsmap: 53 cd $(m3x_package_path) && make byteshashmap-gen \ 54 pkg=builder \ 55 value_type=struct{} \ 56 target_package=$(m3ninx_package)/index/segment/builder \ 57 rename_nogen_key=true \ 58 rename_nogen_value=true \ 59 rename_type_prefix=IDs \ 60 rename_constructor=NewIDsMap \ 61 rename_constructor_options=IDsMapOptions 62 # Rename generated map file 63 mv -f $(m3ninx_package_path)/index/segment/builder/map_gen.go $(m3ninx_package_path)/index/segment/builder/ids_map_gen.go 64 mv -f $(m3ninx_package_path)/index/segment/builder/new_map_gen.go $(m3ninx_package_path)/index/segment/builder/ids_map_new.go 65 66 67 # Map generation rule for index/segment/builder.fieldsMap 68 .PHONY: genny-map-segment-builder-fieldsmap 69 genny-map-segment-builder-fieldsmap: 70 cd $(m3x_package_path) && make byteshashmap-gen \ 71 pkg=builder \ 72 value_type=*terms \ 73 value_type_alias=terms \ 74 target_package=$(m3ninx_package)/index/segment/builder \ 75 rename_nogen_key=true \ 76 rename_type_prefix=fields \ 77 rename_constructor=newFieldsMap \ 78 rename_constructor_options=fieldsMapOptions 79 # Rename generated map file 80 mv -f $(m3ninx_package_path)/index/segment/builder/map_gen.go $(m3ninx_package_path)/index/segment/builder/fields_map_gen.go 81 mv -f $(m3ninx_package_path)/index/segment/builder/new_map_gen.go $(m3ninx_package_path)/index/segment/builder/fields_map_new.go 82 83 # Map generation rule for index/segment/mem.fieldsMap 84 .PHONY: genny-map-segment-mem-fieldsmap 85 genny-map-segment-mem-fieldsmap: 86 cd $(m3x_package_path) && make byteshashmap-gen \ 87 pkg=mem \ 88 value_type=*concurrentPostingsMap \ 89 value_type_alias=concurrentPostingsMap \ 90 target_package=$(m3ninx_package)/index/segment/mem \ 91 rename_nogen_key=true \ 92 rename_type_prefix=fields \ 93 rename_constructor=newFieldsMap \ 94 rename_constructor_options=fieldsMapOptions 95 # Rename generated map file 96 mv -f $(m3ninx_package_path)/index/segment/mem/map_gen.go $(m3ninx_package_path)/index/segment/mem/fields_map_gen.go 97 mv -f $(m3ninx_package_path)/index/segment/mem/new_map_gen.go $(m3ninx_package_path)/index/segment/mem/fields_map_new.go 98 99 # generation rule for all generated arraypools 100 .PHONY: genny-arraypool-all 101 genny-arraypool-all: \ 102 genny-arraypool-bytes-slice-array-pool \ 103 genny-arraypool-document-array-pool \ 104 genny-arraypool-metadata-array-pool \ 105 106 # arraypool generation rule for ./x/bytes.SliceArrayPool 107 .PHONY: genny-arraypool-bytes-slice-array-pool 108 genny-arraypool-bytes-slice-array-pool: 109 cd $(m3x_package_path) && make genny-arraypool \ 110 pkg=bytes \ 111 elem_type=[]byte \ 112 target_package=$(m3ninx_package)/x/bytes \ 113 out_file=slice_arraypool_gen.go \ 114 rename_type_prefix=Slice \ 115 rename_type_middle=Slice \ 116 rename_constructor=NewSliceArrayPool \ 117 118 # arraypool generation rule for ./doc.DocumentArrayPool 119 .PHONY: genny-arraypool-document-array-pool 120 genny-arraypool-document-array-pool: 121 cd $(m3x_package_path) && make genny-arraypool \ 122 pkg=doc \ 123 elem_type=Document \ 124 target_package=$(m3ninx_package)/doc \ 125 out_file=doc_arraypool_gen.go \ 126 rename_type_prefix=Document \ 127 rename_type_middle=Document \ 128 rename_constructor=NewDocumentArrayPool \ 129 rename_gen_types=true \ 130 131 # arraypool generation rule for ./doc.MetadataArrayPool 132 .PHONY: genny-arraypool-metadata-array-pool 133 genny-arraypool-metadata-array-pool: 134 cd $(m3x_package_path) && make genny-arraypool \ 135 pkg=doc \ 136 elem_type=Metadata \ 137 target_package=$(m3ninx_package)/doc \ 138 out_file=metadata_arraypool_gen.go \ 139 rename_type_prefix=Metadata \ 140 rename_type_middle=Metadata \ 141 rename_constructor=NewMetadataArrayPool \ 142 rename_gen_types=true \