redis rpc服务, 提供redis操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

687 lines
19 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. // Code generated by protoc-gen-go.
  2. // source: redis.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package redisrpc is a generated protocol buffer package.
  6. It is generated from these files:
  7. redis.proto
  8. It has these top-level messages:
  9. GetRequest
  10. SetRequest
  11. DelRequest
  12. HGetRequest
  13. HSetRequest
  14. HDelRequest
  15. SetExpireRequest
  16. GetStringResponse
  17. HGetListResponse
  18. SetResponse
  19. DelResponse
  20. HSetResponse
  21. SetExpireResponse
  22. SSetRequest
  23. SMembersRequest
  24. SSetResponse
  25. LSetRequest
  26. LSetResponse
  27. LRangeRequest
  28. LLenRequest
  29. AddRequest
  30. */
  31. package redisrpc
  32. import proto "github.com/chai2010/protorpc/proto"
  33. import math "math"
  34. import "io"
  35. import "log"
  36. import "net"
  37. import "net/rpc"
  38. import "time"
  39. import protorpc "github.com/chai2010/protorpc"
  40. // Reference imports to suppress errors if they are not otherwise used.
  41. var _ = proto.Marshal
  42. var _ = math.Inf
  43. // 使用key查询
  44. type GetRequest struct {
  45. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  46. XXX_unrecognized []byte `json:"-"`
  47. }
  48. func (m *GetRequest) Reset() { *m = GetRequest{} }
  49. func (m *GetRequest) String() string { return proto.CompactTextString(m) }
  50. func (*GetRequest) ProtoMessage() {}
  51. func (m *GetRequest) GetKey() string {
  52. if m != nil && m.Key != nil {
  53. return *m.Key
  54. }
  55. return ""
  56. }
  57. // 设置key
  58. type SetRequest struct {
  59. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  60. Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
  61. Ttl *int64 `protobuf:"varint,3,opt,name=ttl" json:"ttl,omitempty"`
  62. XXX_unrecognized []byte `json:"-"`
  63. }
  64. func (m *SetRequest) Reset() { *m = SetRequest{} }
  65. func (m *SetRequest) String() string { return proto.CompactTextString(m) }
  66. func (*SetRequest) ProtoMessage() {}
  67. func (m *SetRequest) GetKey() string {
  68. if m != nil && m.Key != nil {
  69. return *m.Key
  70. }
  71. return ""
  72. }
  73. func (m *SetRequest) GetValue() string {
  74. if m != nil && m.Value != nil {
  75. return *m.Value
  76. }
  77. return ""
  78. }
  79. func (m *SetRequest) GetTtl() int64 {
  80. if m != nil && m.Ttl != nil {
  81. return *m.Ttl
  82. }
  83. return 0
  84. }
  85. type DelRequest struct {
  86. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  87. XXX_unrecognized []byte `json:"-"`
  88. }
  89. func (m *DelRequest) Reset() { *m = DelRequest{} }
  90. func (m *DelRequest) String() string { return proto.CompactTextString(m) }
  91. func (*DelRequest) ProtoMessage() {}
  92. func (m *DelRequest) GetKey() string {
  93. if m != nil && m.Key != nil {
  94. return *m.Key
  95. }
  96. return ""
  97. }
  98. // 使用hash key查询
  99. type HGetRequest struct {
  100. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  101. Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
  102. XXX_unrecognized []byte `json:"-"`
  103. }
  104. func (m *HGetRequest) Reset() { *m = HGetRequest{} }
  105. func (m *HGetRequest) String() string { return proto.CompactTextString(m) }
  106. func (*HGetRequest) ProtoMessage() {}
  107. func (m *HGetRequest) GetKey() string {
  108. if m != nil && m.Key != nil {
  109. return *m.Key
  110. }
  111. return ""
  112. }
  113. func (m *HGetRequest) GetField() string {
  114. if m != nil && m.Field != nil {
  115. return *m.Field
  116. }
  117. return ""
  118. }
  119. // 设置hash key
  120. type HSetRequest struct {
  121. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  122. Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
  123. Value *string `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"`
  124. XXX_unrecognized []byte `json:"-"`
  125. }
  126. func (m *HSetRequest) Reset() { *m = HSetRequest{} }
  127. func (m *HSetRequest) String() string { return proto.CompactTextString(m) }
  128. func (*HSetRequest) ProtoMessage() {}
  129. func (m *HSetRequest) GetKey() string {
  130. if m != nil && m.Key != nil {
  131. return *m.Key
  132. }
  133. return ""
  134. }
  135. func (m *HSetRequest) GetField() string {
  136. if m != nil && m.Field != nil {
  137. return *m.Field
  138. }
  139. return ""
  140. }
  141. func (m *HSetRequest) GetValue() string {
  142. if m != nil && m.Value != nil {
  143. return *m.Value
  144. }
  145. return ""
  146. }
  147. // 删除hash key
  148. type HDelRequest struct {
  149. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  150. Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
  151. XXX_unrecognized []byte `json:"-"`
  152. }
  153. func (m *HDelRequest) Reset() { *m = HDelRequest{} }
  154. func (m *HDelRequest) String() string { return proto.CompactTextString(m) }
  155. func (*HDelRequest) ProtoMessage() {}
  156. func (m *HDelRequest) GetKey() string {
  157. if m != nil && m.Key != nil {
  158. return *m.Key
  159. }
  160. return ""
  161. }
  162. func (m *HDelRequest) GetField() string {
  163. if m != nil && m.Field != nil {
  164. return *m.Field
  165. }
  166. return ""
  167. }
  168. // 有效期
  169. type SetExpireRequest struct {
  170. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  171. Expire *int64 `protobuf:"varint,2,opt,name=expire" json:"expire,omitempty"`
  172. XXX_unrecognized []byte `json:"-"`
  173. }
  174. func (m *SetExpireRequest) Reset() { *m = SetExpireRequest{} }
  175. func (m *SetExpireRequest) String() string { return proto.CompactTextString(m) }
  176. func (*SetExpireRequest) ProtoMessage() {}
  177. func (m *SetExpireRequest) GetKey() string {
  178. if m != nil && m.Key != nil {
  179. return *m.Key
  180. }
  181. return ""
  182. }
  183. func (m *SetExpireRequest) GetExpire() int64 {
  184. if m != nil && m.Expire != nil {
  185. return *m.Expire
  186. }
  187. return 0
  188. }
  189. // 使用key查询响应结构
  190. type GetStringResponse struct {
  191. Value *string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
  192. XXX_unrecognized []byte `json:"-"`
  193. }
  194. func (m *GetStringResponse) Reset() { *m = GetStringResponse{} }
  195. func (m *GetStringResponse) String() string { return proto.CompactTextString(m) }
  196. func (*GetStringResponse) ProtoMessage() {}
  197. func (m *GetStringResponse) GetValue() string {
  198. if m != nil && m.Value != nil {
  199. return *m.Value
  200. }
  201. return ""
  202. }
  203. // 使用key查询响应结构
  204. type HGetListResponse struct {
  205. List []byte `protobuf:"bytes,1,opt,name=list" json:"list,omitempty"`
  206. XXX_unrecognized []byte `json:"-"`
  207. }
  208. func (m *HGetListResponse) Reset() { *m = HGetListResponse{} }
  209. func (m *HGetListResponse) String() string { return proto.CompactTextString(m) }
  210. func (*HGetListResponse) ProtoMessage() {}
  211. func (m *HGetListResponse) GetList() []byte {
  212. if m != nil {
  213. return m.List
  214. }
  215. return nil
  216. }
  217. // 设置key响应结构
  218. type SetResponse struct {
  219. Ret *string `protobuf:"bytes,1,opt,name=ret" json:"ret,omitempty"`
  220. XXX_unrecognized []byte `json:"-"`
  221. }
  222. func (m *SetResponse) Reset() { *m = SetResponse{} }
  223. func (m *SetResponse) String() string { return proto.CompactTextString(m) }
  224. func (*SetResponse) ProtoMessage() {}
  225. func (m *SetResponse) GetRet() string {
  226. if m != nil && m.Ret != nil {
  227. return *m.Ret
  228. }
  229. return ""
  230. }
  231. // 删除key响应结构
  232. type DelResponse struct {
  233. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  234. XXX_unrecognized []byte `json:"-"`
  235. }
  236. func (m *DelResponse) Reset() { *m = DelResponse{} }
  237. func (m *DelResponse) String() string { return proto.CompactTextString(m) }
  238. func (*DelResponse) ProtoMessage() {}
  239. func (m *DelResponse) GetRet() int64 {
  240. if m != nil && m.Ret != nil {
  241. return *m.Ret
  242. }
  243. return 0
  244. }
  245. // 设置key响应结构
  246. type HSetResponse struct {
  247. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  248. XXX_unrecognized []byte `json:"-"`
  249. }
  250. func (m *HSetResponse) Reset() { *m = HSetResponse{} }
  251. func (m *HSetResponse) String() string { return proto.CompactTextString(m) }
  252. func (*HSetResponse) ProtoMessage() {}
  253. func (m *HSetResponse) GetRet() int64 {
  254. if m != nil && m.Ret != nil {
  255. return *m.Ret
  256. }
  257. return 0
  258. }
  259. // 设置key有效期
  260. type SetExpireResponse struct {
  261. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  262. XXX_unrecognized []byte `json:"-"`
  263. }
  264. func (m *SetExpireResponse) Reset() { *m = SetExpireResponse{} }
  265. func (m *SetExpireResponse) String() string { return proto.CompactTextString(m) }
  266. func (*SetExpireResponse) ProtoMessage() {}
  267. func (m *SetExpireResponse) GetRet() int64 {
  268. if m != nil && m.Ret != nil {
  269. return *m.Ret
  270. }
  271. return 0
  272. }
  273. // 集合添加值
  274. type SSetRequest struct {
  275. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  276. Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
  277. XXX_unrecognized []byte `json:"-"`
  278. }
  279. func (m *SSetRequest) Reset() { *m = SSetRequest{} }
  280. func (m *SSetRequest) String() string { return proto.CompactTextString(m) }
  281. func (*SSetRequest) ProtoMessage() {}
  282. func (m *SSetRequest) GetKey() string {
  283. if m != nil && m.Key != nil {
  284. return *m.Key
  285. }
  286. return ""
  287. }
  288. func (m *SSetRequest) GetField() string {
  289. if m != nil && m.Field != nil {
  290. return *m.Field
  291. }
  292. return ""
  293. }
  294. // 集合添加值
  295. type SMembersRequest struct {
  296. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  297. XXX_unrecognized []byte `json:"-"`
  298. }
  299. func (m *SMembersRequest) Reset() { *m = SMembersRequest{} }
  300. func (m *SMembersRequest) String() string { return proto.CompactTextString(m) }
  301. func (*SMembersRequest) ProtoMessage() {}
  302. func (m *SMembersRequest) GetKey() string {
  303. if m != nil && m.Key != nil {
  304. return *m.Key
  305. }
  306. return ""
  307. }
  308. // 设置响应结构
  309. type SSetResponse struct {
  310. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  311. XXX_unrecognized []byte `json:"-"`
  312. }
  313. func (m *SSetResponse) Reset() { *m = SSetResponse{} }
  314. func (m *SSetResponse) String() string { return proto.CompactTextString(m) }
  315. func (*SSetResponse) ProtoMessage() {}
  316. func (m *SSetResponse) GetRet() int64 {
  317. if m != nil && m.Ret != nil {
  318. return *m.Ret
  319. }
  320. return 0
  321. }
  322. // 列表添加值
  323. type LSetRequest struct {
  324. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  325. Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
  326. XXX_unrecognized []byte `json:"-"`
  327. }
  328. func (m *LSetRequest) Reset() { *m = LSetRequest{} }
  329. func (m *LSetRequest) String() string { return proto.CompactTextString(m) }
  330. func (*LSetRequest) ProtoMessage() {}
  331. func (m *LSetRequest) GetKey() string {
  332. if m != nil && m.Key != nil {
  333. return *m.Key
  334. }
  335. return ""
  336. }
  337. func (m *LSetRequest) GetField() string {
  338. if m != nil && m.Field != nil {
  339. return *m.Field
  340. }
  341. return ""
  342. }
  343. // 设置key响应结构
  344. type LSetResponse struct {
  345. Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
  346. XXX_unrecognized []byte `json:"-"`
  347. }
  348. func (m *LSetResponse) Reset() { *m = LSetResponse{} }
  349. func (m *LSetResponse) String() string { return proto.CompactTextString(m) }
  350. func (*LSetResponse) ProtoMessage() {}
  351. func (m *LSetResponse) GetRet() int64 {
  352. if m != nil && m.Ret != nil {
  353. return *m.Ret
  354. }
  355. return 0
  356. }
  357. // 列表取值
  358. type LRangeRequest struct {
  359. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  360. Start *int64 `protobuf:"varint,2,opt,name=start" json:"start,omitempty"`
  361. Stop *int64 `protobuf:"varint,3,opt,name=stop" json:"stop,omitempty"`
  362. XXX_unrecognized []byte `json:"-"`
  363. }
  364. func (m *LRangeRequest) Reset() { *m = LRangeRequest{} }
  365. func (m *LRangeRequest) String() string { return proto.CompactTextString(m) }
  366. func (*LRangeRequest) ProtoMessage() {}
  367. func (m *LRangeRequest) GetKey() string {
  368. if m != nil && m.Key != nil {
  369. return *m.Key
  370. }
  371. return ""
  372. }
  373. func (m *LRangeRequest) GetStart() int64 {
  374. if m != nil && m.Start != nil {
  375. return *m.Start
  376. }
  377. return 0
  378. }
  379. func (m *LRangeRequest) GetStop() int64 {
  380. if m != nil && m.Stop != nil {
  381. return *m.Stop
  382. }
  383. return 0
  384. }
  385. // 列表长度
  386. type LLenRequest struct {
  387. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  388. XXX_unrecognized []byte `json:"-"`
  389. }
  390. func (m *LLenRequest) Reset() { *m = LLenRequest{} }
  391. func (m *LLenRequest) String() string { return proto.CompactTextString(m) }
  392. func (*LLenRequest) ProtoMessage() {}
  393. func (m *LLenRequest) GetKey() string {
  394. if m != nil && m.Key != nil {
  395. return *m.Key
  396. }
  397. return ""
  398. }
  399. // 数值增加
  400. type AddRequest struct {
  401. Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
  402. Value *int64 `protobuf:"varint,2,opt,name=value" json:"value,omitempty"`
  403. XXX_unrecognized []byte `json:"-"`
  404. }
  405. func (m *AddRequest) Reset() { *m = AddRequest{} }
  406. func (m *AddRequest) String() string { return proto.CompactTextString(m) }
  407. func (*AddRequest) ProtoMessage() {}
  408. func (m *AddRequest) GetKey() string {
  409. if m != nil && m.Key != nil {
  410. return *m.Key
  411. }
  412. return ""
  413. }
  414. func (m *AddRequest) GetValue() int64 {
  415. if m != nil && m.Value != nil {
  416. return *m.Value
  417. }
  418. return 0
  419. }
  420. func init() {
  421. }
  422. type RedisService interface {
  423. Get(in *GetRequest, out *GetStringResponse) error
  424. Set(in *SetRequest, out *SetResponse) error
  425. SetNx(in *SetRequest, out *DelResponse) error
  426. Del(in *DelRequest, out *DelResponse) error
  427. HGet(in *HGetRequest, out *GetStringResponse) error
  428. HSet(in *HSetRequest, out *HSetResponse) error
  429. HDel(in *HDelRequest, out *DelResponse) error
  430. SetExpire(in *SetExpireRequest, out *SetExpireResponse) error
  431. HGetAll(in *GetRequest, out *HGetListResponse) error
  432. HGetList(in *GetRequest, out *HGetListResponse) error
  433. HExists(in *HGetRequest, out *DelResponse) error
  434. Exists(in *GetRequest, out *DelResponse) error
  435. HIncrby(in *HSetRequest, out *HSetResponse) error
  436. SAdd(in *SSetRequest, out *SSetResponse) error
  437. SIsmember(in *SSetRequest, out *SSetResponse) error
  438. SRem(in *SSetRequest, out *SSetResponse) error
  439. LLpush(in *LSetRequest, out *LSetResponse) error
  440. LRpush(in *LSetRequest, out *LSetResponse) error
  441. LRange(in *LRangeRequest, out *HGetListResponse) error
  442. LLen(in *LLenRequest, out *LSetResponse) error
  443. ReduceStock(in *SetRequest, out *SetResponse) error
  444. Incrby(in *AddRequest, out *SetResponse) error
  445. Decrby(in *AddRequest, out *SetResponse) error
  446. }
  447. // AcceptRedisServiceClient accepts connections on the listener and serves requests
  448. // for each incoming connection. Accept blocks; the caller typically
  449. // invokes it in a go statement.
  450. func AcceptRedisServiceClient(lis net.Listener, x RedisService) {
  451. srv := rpc.NewServer()
  452. if err := srv.RegisterName("RedisService", x); err != nil {
  453. log.Fatal(err)
  454. }
  455. for {
  456. conn, err := lis.Accept()
  457. if err != nil {
  458. log.Fatalf("lis.Accept(): %v\n", err)
  459. }
  460. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  461. }
  462. }
  463. // RegisterRedisService publish the given RedisService implementation on the server.
  464. func RegisterRedisService(srv *rpc.Server, x RedisService) error {
  465. if err := srv.RegisterName("RedisService", x); err != nil {
  466. return err
  467. }
  468. return nil
  469. }
  470. // NewRedisServiceServer returns a new RedisService Server.
  471. func NewRedisServiceServer(x RedisService) *rpc.Server {
  472. srv := rpc.NewServer()
  473. if err := srv.RegisterName("RedisService", x); err != nil {
  474. log.Fatal(err)
  475. }
  476. return srv
  477. }
  478. // ListenAndServeRedisService listen announces on the local network address laddr
  479. // and serves the given RedisService implementation.
  480. func ListenAndServeRedisService(network, addr string, x RedisService) error {
  481. lis, err := net.Listen(network, addr)
  482. if err != nil {
  483. return err
  484. }
  485. defer lis.Close()
  486. srv := rpc.NewServer()
  487. if err := srv.RegisterName("RedisService", x); err != nil {
  488. return err
  489. }
  490. for {
  491. conn, err := lis.Accept()
  492. if err != nil {
  493. log.Fatalf("lis.Accept(): %v\n", err)
  494. }
  495. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  496. }
  497. }
  498. type RedisServiceClient struct {
  499. *rpc.Client
  500. }
  501. // NewRedisServiceClient returns a RedisService rpc.Client and stub to handle
  502. // requests to the set of RedisService at the other end of the connection.
  503. func NewRedisServiceClient(conn io.ReadWriteCloser) (*RedisServiceClient, *rpc.Client) {
  504. c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
  505. return &RedisServiceClient{c}, c
  506. }
  507. func (c *RedisServiceClient) Get(in *GetRequest, out *GetStringResponse) error {
  508. return c.Call("RedisService.Get", in, out)
  509. }
  510. func (c *RedisServiceClient) Set(in *SetRequest, out *SetResponse) error {
  511. return c.Call("RedisService.Set", in, out)
  512. }
  513. func (c *RedisServiceClient) SetNx(in *SetRequest, out *DelResponse) error {
  514. return c.Call("RedisService.SetNx", in, out)
  515. }
  516. func (c *RedisServiceClient) Del(in *DelRequest, out *DelResponse) error {
  517. return c.Call("RedisService.Del", in, out)
  518. }
  519. func (c *RedisServiceClient) HGet(in *HGetRequest, out *GetStringResponse) error {
  520. return c.Call("RedisService.HGet", in, out)
  521. }
  522. func (c *RedisServiceClient) HSet(in *HSetRequest, out *HSetResponse) error {
  523. return c.Call("RedisService.HSet", in, out)
  524. }
  525. func (c *RedisServiceClient) HDel(in *HDelRequest, out *DelResponse) error {
  526. return c.Call("RedisService.HDel", in, out)
  527. }
  528. func (c *RedisServiceClient) SetExpire(in *SetExpireRequest, out *SetExpireResponse) error {
  529. return c.Call("RedisService.SetExpire", in, out)
  530. }
  531. func (c *RedisServiceClient) HGetAll(in *GetRequest, out *HGetListResponse) error {
  532. return c.Call("RedisService.HGetAll", in, out)
  533. }
  534. func (c *RedisServiceClient) HGetList(in *GetRequest, out *HGetListResponse) error {
  535. return c.Call("RedisService.HGetList", in, out)
  536. }
  537. func (c *RedisServiceClient) HExists(in *HGetRequest, out *DelResponse) error {
  538. return c.Call("RedisService.HExists", in, out)
  539. }
  540. func (c *RedisServiceClient) Exists(in *GetRequest, out *DelResponse) error {
  541. return c.Call("RedisService.Exists", in, out)
  542. }
  543. func (c *RedisServiceClient) HIncrby(in *HSetRequest, out *HSetResponse) error {
  544. return c.Call("RedisService.HIncrby", in, out)
  545. }
  546. func (c *RedisServiceClient) SAdd(in *SSetRequest, out *SSetResponse) error {
  547. return c.Call("RedisService.SAdd", in, out)
  548. }
  549. func (c *RedisServiceClient) SIsmember(in *SSetRequest, out *SSetResponse) error {
  550. return c.Call("RedisService.SIsmember", in, out)
  551. }
  552. func (c *RedisServiceClient) SRem(in *SSetRequest, out *SSetResponse) error {
  553. return c.Call("RedisService.SRem", in, out)
  554. }
  555. func (c *RedisServiceClient) LLpush(in *LSetRequest, out *LSetResponse) error {
  556. return c.Call("RedisService.LLpush", in, out)
  557. }
  558. func (c *RedisServiceClient) LRpush(in *LSetRequest, out *LSetResponse) error {
  559. return c.Call("RedisService.LRpush", in, out)
  560. }
  561. func (c *RedisServiceClient) LRange(in *LRangeRequest, out *HGetListResponse) error {
  562. return c.Call("RedisService.LRange", in, out)
  563. }
  564. func (c *RedisServiceClient) LLen(in *LLenRequest, out *LSetResponse) error {
  565. return c.Call("RedisService.LLen", in, out)
  566. }
  567. func (c *RedisServiceClient) ReduceStock(in *SetRequest, out *SetResponse) error {
  568. return c.Call("RedisService.ReduceStock", in, out)
  569. }
  570. func (c *RedisServiceClient) Incrby(in *AddRequest, out *SetResponse) error {
  571. return c.Call("RedisService.Incrby", in, out)
  572. }
  573. func (c *RedisServiceClient) Decrby(in *AddRequest, out *SetResponse) error {
  574. return c.Call("RedisService.Decrby", in, out)
  575. }
  576. // DialRedisService connects to an RedisService at the specified network address.
  577. func DialRedisService(network, addr string) (*RedisServiceClient, *rpc.Client, error) {
  578. c, err := protorpc.Dial(network, addr)
  579. if err != nil {
  580. return nil, nil, err
  581. }
  582. return &RedisServiceClient{c}, c, nil
  583. }
  584. // DialRedisServiceTimeout connects to an RedisService at the specified network address.
  585. func DialRedisServiceTimeout(network, addr string,
  586. timeout time.Duration) (*RedisServiceClient, *rpc.Client, error) {
  587. c, err := protorpc.DialTimeout(network, addr, timeout)
  588. if err != nil {
  589. return nil, nil, err
  590. }
  591. return &RedisServiceClient{c}, c, nil
  592. }