Slide 1

Slide 1 text

at Go 1.10 Release Party in Tokyo more expressive gRPC client Evans

Slide 2

Slide 2 text

XIPBNJ !cJE LUS@ ձ௡େֶֶ෦೥ ιϥϛπגࣜձࣾαʔόΤϯδχΞ

Slide 3

Slide 3 text

at Go 1.10 Release Party in Tokyo more expressive gRPC client Evans

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

ΞδΣϯμ w H31$ͱΫϥΠΞϯτπʔϧ܈ w &WBOTͱ&WBOT͕໨ࢦͨ͠΋ͷ w &WBOTͷΞʔΩςΫνϟͱ࣮૷

Slide 6

Slide 6 text

H31$

Slide 7

Slide 7 text

gRPC DMJFOUTFSWFSؒͰಁաతʹ௨৴Ͱ͖ΔγεςϜΛ ߏங͢ΔͨΊͷ31$ϑϨʔϜϫʔΫ

Slide 8

Slide 8 text

gRPC *%-Ͱ"1*εΩʔϚΛఆٛ͢Δ ΫϥΠΞϯταʔόͷίʔυΛੜ੒͢Δ αʔόͷϩδοΫΛ࣮૷͢Δ

Slide 9

Slide 9 text

H31$3FNPUF1SPDFEVSF$BMMT PGDPVSTF IUUQTHSQDJPGBR

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

gRPC ͷྑ͍ͱ͜Ζ w"1*࢓༷ͱ࣮૷ͷဃ཭Λ๷͙͜ͱ͕Ͱ͖Δ wΫϥΠΞϯταʔόؒͷ*'͕෗ഊ͠ͳ͍ w4USFBNJOH31$ wFUD

Slide 12

Slide 12 text

gRPC ͷͭΒ͍ͱ͜Ζ w)551͔͠αϙʔτ͍ͯ͠ͳ͍ wπʔϧɾϛυϧ΢ΣΞ܈͕ॆ࣮͍ͯ͠ͳ͍ w"1*ͷσόοά͕ͮ͠Β͍

Slide 13

Slide 13 text

gRPC ͷͭΒ͍ͱ͜Ζ w)551͔͠αϙʔτ͍ͯ͠ͳ͍ wπʔϧɾϛυϧ΢ΣΞ܈͕ॆ࣮͍ͯ͠ͳ͍ w"1*ͷσόοά͕ͮ͠Β͍

Slide 14

Slide 14 text

API ͷσόοά͕ͮ͠Β͍ wH31$͸σʔλΛγϦΞϥΠζͯ͠΍ΓͱΓ͢Δ wDVSM΍XHFU౳ͰςετͰ͖ͳ͍ wΫϥΠΞϯτίʔυΛ࣮૷͢ΔPSπʔϧͷར༻

Slide 15

Slide 15 text

grpc-ecosystem / polyglot w "'"*, ࠷΋ߴػೳͳΫϥΠΞϯτ w+BWB੡ wͨ͘͞ΜͷΦϓγϣϯΛίϚϯυϥΠϯͰࢦఆ͢ Δඞཁ͕͋ͬͯ൥ࡶ

Slide 16

Slide 16 text

grpc-ecosystem / polyglot 1 $ echo | java -jar polyglot.jar \ 2 --command=call \ 3 --endpoint=: \ 4 --full_method= \ 5 --proto_discovery_root=

Slide 17

Slide 17 text

njpatel / grpcc w/PEFKT੡ w3&1-PS$-*Ͱͷ࣮ߦ͕Մೳ w3&1-Ͱ+BWB4DSJQUΛॻ͘ඞཁ͕͋Δ wิ׬͕ͳ͍

Slide 18

Slide 18 text

njpatel / grpcc

Slide 19

Slide 19 text

͍·͍ͪͬ͘͠Γ͜ͳ͍

Slide 20

Slide 20 text

ސ٬ ͕ຊ౰ʹཉ͔ͬͨ͠΋ͷ

Slide 21

Slide 21 text

ސ٬ ͕ຊ౰ʹཉ͔ͬͨ͠΋ͷ ָʹςετͰ͖ΔΫϥΠΞϯτ

Slide 22

Slide 22 text

Ұ͔Βͭ͘Δͧ

Slide 23

Slide 23 text

LUSFWBOT

Slide 24

Slide 24 text

ktr0731 / evans w(P੡ wָʹ͔ͭ͑ΔΫϥΠΞϯτ w1SPUPDPM#V⒎FST

Slide 25

Slide 25 text

Ϣʔεέʔε wσόοά ɺςετ wγΣϧεΫϦϓτ΁ͷ૊ΈࠐΈ

Slide 26

Slide 26 text

σόοάɺςετ wجຊతʹखಈͰ"1*Λୟ͘ wͰ͖Δ͚ͩλΠϓͨ͘͠ͳ͍ w๛෋ͳิ׬͕ཉ͍͠ wෳ਺ͷ"1*Λୟ͖͍ͨ৔߹΋͋Δ

Slide 27

Slide 27 text

γΣϧεΫϦϓτ΁ͷ૊ΈࠐΈ wTUEJOPSpMFTUEPVU w૊ΈࠐΈ΍͍͢ΠϯλʔϑΣʔε͕ඞཁ

Slide 28

Slide 28 text

Ϣʔεέʔε wσόοά ɺςετ 3&1-Ϟʔυ wγΣϧεΫϦϓτ΁ͷ૊ΈࠐΈ ίϚϯυϥΠϯϞʔυ

Slide 29

Slide 29 text

EFNP LUSFWBOTEFNP

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Evans Internal w εΩʔϚͷϩʔυ w &WBOTͷϞσϧ΁ͷม׵ w 31$ͷൃߦ $-*Ϟʔυ PS 3&1-ͷىಈ 3&1-Ϟʔυ

Slide 33

Slide 33 text

DBTF3&1-31$DBMM

Slide 34

Slide 34 text

εΩʔϚͷϩʔυ 1 func runProtoc(args []string) ([]byte, error) { 2 buf, errBuf := new(bytes.Buffer), new(bytes.Buffer) 3 4 // with "--descriptor_set_out=/dev/stdout" 5 cmd := exec.Command("protoc", args...) 6 cmd.Stdout = buf 7 cmd.Stderr = errBuf 8 if err := cmd.Run(); err != nil { 9 if errBuf.Len() != 0 { 10 return nil, errors.New(errBuf.String()) 11 } 12 return nil, err 13 } 14 return buf.Bytes(), nil 15 }

Slide 35

Slide 35 text

wHPMBOHQSPUPCVGEFTDSJQUPS wHPMBOHQSPUPCVGQSPUP εΩʔϚͷϩʔυ 1 code, _ := runProtoc(args) 2 ds := descriptor.FileDescriptorSet{} 3 proto.Unmarshal(code, &ds)

Slide 36

Slide 36 text

Ϟσϧ΁ͷม׵ wΞϓϦέʔγϣϯ͔Βѻ͍΍͘͢͢ΔͨΊ wKIVNQQSPUPSFqFDU΁ͷґଘΛͳͨ͘͢Ί ޙड़

Slide 37

Slide 37 text

REPL: read wDCBUBHPQSPNQU

Slide 38

Slide 38 text

REPL: read / eval wϑΟʔϧυΛ࠶ؼతʹḷΔ wϓϦϛςΟϒܕͰ͋Ε͹஋Λೖྗͤ͞Δ

Slide 39

Slide 39 text

1 message User { 2 string first_name = 1; 3 string last_name = 2; 4 Gender gender = 3; 5 } 6 7 message RegisterUsersRequest { 8 repeated User users = 1; 9 } type = "double" | "float" | "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64" | "fixed32" | "fixed64" | "sfixed32" | "sfixed64" | "bool" | "string" | "bytes" | messageType | enumType

Slide 40

Slide 40 text

1 message User { 2 string first_name = 1; 3 string last_name = 2; 4 Gender gender = 3; 5 } 6 7 message RegisterUsersRequest { 8 repeated User users = 1; 9 } type = "double" | "float" | "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64" | "fixed32" | "fixed64" | "sfixed32" | "sfixed64" | "bool" | "string" | "bytes" | messageType | enumType

Slide 41

Slide 41 text

type = "double" | "float" | "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64" | "fixed32" | "fixed64" | "sfixed32" | "sfixed64" | "bool" | "string" | "bytes" | messageType | enumType 1 message User { 2 string first_name = 1; 3 string last_name = 2; 4 Gender gender = 3; 5 } 6 7 message RegisterUsersRequest { 8 repeated User users = 1; 9 }

Slide 42

Slide 42 text

ϓϦϛςΟϒܕͷೖྗ wೖྗΛड͚͚ͭΔ DCBUBHPQSPNQU wରԠ͢Δܕ΁ม׵ wϑΟʔϧυʹ஋Ληοτ͢Δ KIVNQQSPUPSFqFDU wೖྗର৅ͷϝοηʔδ͸ಈతʹܾఆ͞ΕΔ

Slide 43

Slide 43 text

ϝοηʔδͷಈతͳߏங wKIVNQQSPUPSFqFDUEZOBNJD.FTTBHF wQSPUP.BSTIBMFS࣮૷Λ࣋ͭ

Slide 44

Slide 44 text

ϝοηʔδͷಈతͳߏங ֤ϑΟʔϧυ஋ΛEZOBNJD.FTTBHF͕อ࣋ #V⒎FS.BSTIBM΁QSPUP.FTTBHFͱͯ͠౉͞ΕΔ .BSTIBM͕QSPUP.BSTIBMFSͷ࣮૷ΛݺͿ EZOBNJD.FTTBHF.BSTIBMʹΑΓγϦΞϥΠζ

Slide 45

Slide 45 text

QSPUP.FTTBHF QSPUP.BSTIBMFS EZOBNJD.FTTBHF Marshal() ([]byte, error) CVG WBMVFT encode marshal each field values ϝοηʔδͷಈతͳߏங

Slide 46

Slide 46 text

ΞʔΩςΫνϟ w $MFBO"SDIJUFDUVSF w )FYBHPOBM"SDIJUFDUVSF

Slide 47

Slide 47 text

ͳͥ CA / HA ͔ʁ w ࠜװΛࢧ͑ΔϥΠϒϥϦ͕ະ੒ख़ w $-*Ϟʔυɺ3&1-Ϟʔυ͕͋Δ w ίϯϙʔωϯτ͕ଟ͍

Slide 48

Slide 48 text

JOQVUUFS*' 3&1- 1SPNQU*OQVUUFS DCBUBHPQSPNQU $-* +40/JOQVUUFS FODPEJOHKTPO Entity layer Adapter layer UseCase layer EFTDSJQUPST KIVNQQSPUPSFqFDU pFMET NFTTBHF TFSWJDF*'

Slide 49

Slide 49 text

TODOs w ετϦʔϜछ w 5-4ରԠ w ϦϑϨΫγϣϯαʔόରԠ w FUD

Slide 50

Slide 50 text

TODOs w ετϦʔϜछ w 5-4ରԠ w ϦϑϨΫγϣϯαʔόରԠ w FUD 1VMM3FRVFTUT*TTVFT XFMDPNF

Slide 51

Slide 51 text

·ͱΊ w ݸਓతʹ͸ ָʹ͔ͭ͑ΔΫϥΠΞϯτ͕Ͱ͖ͨ w ڊਓͷݞʹ৐͍ͬͯΔ͓͔͛Ͱ͢ w ͱ͸͍͑50%0͸·ͩଟ͍

Slide 52

Slide 52 text

·ͱΊ w ݸਓతʹ͸ ָʹ͔ͭ͑ΔΫϥΠΞϯτ͕Ͱ͖ͨ w ڊਓͷݞʹ৐͍ͬͯΔ͓͔͛Ͱ͢ w ͱ͸͍͑50%0͸·ͩଟ͍ ΍͍ͬͯͧ͘ʂʂ