Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: go/src/infra/crimson/server/frontend/crimson_service.go

Issue 2108643006: crimson server: Implemented SelectHost and InsertHost (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@mactohex
Patch Set: Added NULL support for boot class Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package frontend 5 package frontend
6 6
7 import ( 7 import (
8 "golang.org/x/net/context" 8 "golang.org/x/net/context"
9 9
10 "google.golang.org/grpc" 10 "google.golang.org/grpc"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 ret.Ranges, 50 ret.Ranges,
51 &crimson.IPRange{ 51 &crimson.IPRange{
52 Site: row.Site, 52 Site: row.Site,
53 Vlan: row.Vlan, 53 Vlan: row.Vlan,
54 StartIp: row.StartIP, 54 StartIp: row.StartIP,
55 EndIp: row.EndIP, 55 EndIp: row.EndIP,
56 }) 56 })
57 } 57 }
58 return &ret, nil 58 return &ret, nil
59 } 59 }
60
61 func (s *crimsonService) CreateHost(ctx context.Context, req *crimson.HostList) (*crimson.HostStatus, error) {
62 err := crimsondb.InsertHost(ctx, req)
63 return &crimson.HostStatus{}, userErrorToGRPCError(err)
64 }
65
66 func (s *crimsonService) ReadHost(ctx context.Context, req *crimson.HostQuery) ( *crimson.HostList, error) {
67 rows, err := crimsondb.SelectHost(ctx, req)
68
69 if err == nil {
70 return rows, nil
71 }
72 return nil, userErrorToGRPCError(err)
73 }
OLDNEW
« no previous file with comments | « go/src/infra/crimson/server/crimsondb/crimsondb_test.go ('k') | go/src/infra/crimson/sql/schema.sql » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698