]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/thrift/lib/go/thrift/processor_factory.go
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / lib / go / thrift / processor_factory.go
CommitLineData
f67539c2
TL
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20package thrift
21
22import "context"
23
24// A processor is a generic object which operates upon an input stream and
25// writes to some output stream.
26type TProcessor interface {
27 Process(ctx context.Context, in, out TProtocol) (bool, TException)
28}
29
30type TProcessorFunction interface {
31 Process(ctx context.Context, seqId int32, in, out TProtocol) (bool, TException)
32}
33
34// The default processor factory just returns a singleton
35// instance.
36type TProcessorFactory interface {
37 GetProcessor(trans TTransport) TProcessor
38}
39
40type tProcessorFactory struct {
41 processor TProcessor
42}
43
44func NewTProcessorFactory(p TProcessor) TProcessorFactory {
45 return &tProcessorFactory{processor: p}
46}
47
48func (p *tProcessorFactory) GetProcessor(trans TTransport) TProcessor {
49 return p.processor
50}
51
52/**
53 * The default processor factory just returns a singleton
54 * instance.
55 */
56type TProcessorFunctionFactory interface {
57 GetProcessorFunction(trans TTransport) TProcessorFunction
58}
59
60type tProcessorFunctionFactory struct {
61 processor TProcessorFunction
62}
63
64func NewTProcessorFunctionFactory(p TProcessorFunction) TProcessorFunctionFactory {
65 return &tProcessorFunctionFactory{processor: p}
66}
67
68func (p *tProcessorFunctionFactory) GetProcessorFunction(trans TTransport) TProcessorFunction {
69 return p.processor
70}