Phase 2 service decomposition per docs/SCALE-EXPANSION.md section 1: extracts
internal/{airwallex,bridge,card,tenant,httpserver} out of the monolithic
gateway into four independently deployable gRPC services (each own go.mod,
Dockerfile, and tests), with gateway now a thin BFF that fans out through new
cardissuanceclient/webhookeventsclient gRPC clients. gateway.proto's external
surface is unchanged — agent/tui/cli still talk to gateway exactly as before.
Verified: all 10 go.work modules build and `go test ./...` passes across
every one, including the new gateway client packages against the live split
services (via `make build && make test`).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
246 lines
10 KiB
Go
246 lines
10 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.6.2
|
|
// - protoc v6.33.4
|
|
// source: audit.proto
|
|
|
|
package audit
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.64.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion9
|
|
|
|
const (
|
|
AuditLog_Append_FullMethodName = "/ration.audit.v1.AuditLog/Append"
|
|
AuditLog_ListRecords_FullMethodName = "/ration.audit.v1.AuditLog/ListRecords"
|
|
AuditLog_VerifyChain_FullMethodName = "/ration.audit.v1.AuditLog/VerifyChain"
|
|
)
|
|
|
|
// AuditLogClient is the client API for AuditLog service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
//
|
|
// AuditLog is an independent, append-only mirror of every money-moving and
|
|
// agent-decision event in the system. It is a deliberately separate trust
|
|
// boundary from ledger-core's own WAL: ledger-core (or a compromised
|
|
// service calling it) can never rewrite or delete what has already landed
|
|
// here, because this service only ever appends, and every record is
|
|
// chained to the previous one by hash so a gap or edit is detectable by
|
|
// VerifyChain.
|
|
//
|
|
// Writers (ledger-core mirroring ApplyEntry/RecordAgentDecision outcomes)
|
|
// treat every RPC here as best-effort: a failure to reach this service
|
|
// must never block or fail the original operation. AuditLog is a safety
|
|
// net for incident review and compliance, not a dependency the hot path
|
|
// can fail on.
|
|
type AuditLogClient interface {
|
|
// Append writes one audit record. It is idempotent on
|
|
// (source_service, kind, ref_id): re-appending the same
|
|
// (source_service, kind, ref_id) returns the original record rather
|
|
// than creating a duplicate, since a best-effort caller may retry after
|
|
// an ambiguous failure (e.g. it applied but the ack was lost).
|
|
Append(ctx context.Context, in *AppendRequest, opts ...grpc.CallOption) (*AppendResponse, error)
|
|
// ListRecords returns recorded entries for a tenant, oldest first,
|
|
// paginated. tenant_id empty lists across all tenants (operator use).
|
|
ListRecords(ctx context.Context, in *ListRecordsRequest, opts ...grpc.CallOption) (*ListRecordsResponse, error)
|
|
// VerifyChain walks the full hash chain from genesis and reports the
|
|
// first broken link, if any — the mechanism that makes "append-only"
|
|
// an enforced property rather than just a convention.
|
|
VerifyChain(ctx context.Context, in *VerifyChainRequest, opts ...grpc.CallOption) (*VerifyChainResponse, error)
|
|
}
|
|
|
|
type auditLogClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewAuditLogClient(cc grpc.ClientConnInterface) AuditLogClient {
|
|
return &auditLogClient{cc}
|
|
}
|
|
|
|
func (c *auditLogClient) Append(ctx context.Context, in *AppendRequest, opts ...grpc.CallOption) (*AppendResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(AppendResponse)
|
|
err := c.cc.Invoke(ctx, AuditLog_Append_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *auditLogClient) ListRecords(ctx context.Context, in *ListRecordsRequest, opts ...grpc.CallOption) (*ListRecordsResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ListRecordsResponse)
|
|
err := c.cc.Invoke(ctx, AuditLog_ListRecords_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *auditLogClient) VerifyChain(ctx context.Context, in *VerifyChainRequest, opts ...grpc.CallOption) (*VerifyChainResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(VerifyChainResponse)
|
|
err := c.cc.Invoke(ctx, AuditLog_VerifyChain_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// AuditLogServer is the server API for AuditLog service.
|
|
// All implementations must embed UnimplementedAuditLogServer
|
|
// for forward compatibility.
|
|
//
|
|
// AuditLog is an independent, append-only mirror of every money-moving and
|
|
// agent-decision event in the system. It is a deliberately separate trust
|
|
// boundary from ledger-core's own WAL: ledger-core (or a compromised
|
|
// service calling it) can never rewrite or delete what has already landed
|
|
// here, because this service only ever appends, and every record is
|
|
// chained to the previous one by hash so a gap or edit is detectable by
|
|
// VerifyChain.
|
|
//
|
|
// Writers (ledger-core mirroring ApplyEntry/RecordAgentDecision outcomes)
|
|
// treat every RPC here as best-effort: a failure to reach this service
|
|
// must never block or fail the original operation. AuditLog is a safety
|
|
// net for incident review and compliance, not a dependency the hot path
|
|
// can fail on.
|
|
type AuditLogServer interface {
|
|
// Append writes one audit record. It is idempotent on
|
|
// (source_service, kind, ref_id): re-appending the same
|
|
// (source_service, kind, ref_id) returns the original record rather
|
|
// than creating a duplicate, since a best-effort caller may retry after
|
|
// an ambiguous failure (e.g. it applied but the ack was lost).
|
|
Append(context.Context, *AppendRequest) (*AppendResponse, error)
|
|
// ListRecords returns recorded entries for a tenant, oldest first,
|
|
// paginated. tenant_id empty lists across all tenants (operator use).
|
|
ListRecords(context.Context, *ListRecordsRequest) (*ListRecordsResponse, error)
|
|
// VerifyChain walks the full hash chain from genesis and reports the
|
|
// first broken link, if any — the mechanism that makes "append-only"
|
|
// an enforced property rather than just a convention.
|
|
VerifyChain(context.Context, *VerifyChainRequest) (*VerifyChainResponse, error)
|
|
mustEmbedUnimplementedAuditLogServer()
|
|
}
|
|
|
|
// UnimplementedAuditLogServer must be embedded to have
|
|
// forward compatible implementations.
|
|
//
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
// pointer dereference when methods are called.
|
|
type UnimplementedAuditLogServer struct{}
|
|
|
|
func (UnimplementedAuditLogServer) Append(context.Context, *AppendRequest) (*AppendResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Append not implemented")
|
|
}
|
|
func (UnimplementedAuditLogServer) ListRecords(context.Context, *ListRecordsRequest) (*ListRecordsResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method ListRecords not implemented")
|
|
}
|
|
func (UnimplementedAuditLogServer) VerifyChain(context.Context, *VerifyChainRequest) (*VerifyChainResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method VerifyChain not implemented")
|
|
}
|
|
func (UnimplementedAuditLogServer) mustEmbedUnimplementedAuditLogServer() {}
|
|
func (UnimplementedAuditLogServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeAuditLogServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to AuditLogServer will
|
|
// result in compilation errors.
|
|
type UnsafeAuditLogServer interface {
|
|
mustEmbedUnimplementedAuditLogServer()
|
|
}
|
|
|
|
func RegisterAuditLogServer(s grpc.ServiceRegistrar, srv AuditLogServer) {
|
|
// If the following call panics, it indicates UnimplementedAuditLogServer was
|
|
// embedded by pointer and is nil. This will cause panics if an
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
|
// time to prevent it from happening at runtime later due to I/O.
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
t.testEmbeddedByValue()
|
|
}
|
|
s.RegisterService(&AuditLog_ServiceDesc, srv)
|
|
}
|
|
|
|
func _AuditLog_Append_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(AppendRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(AuditLogServer).Append(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: AuditLog_Append_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(AuditLogServer).Append(ctx, req.(*AppendRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _AuditLog_ListRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ListRecordsRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(AuditLogServer).ListRecords(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: AuditLog_ListRecords_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(AuditLogServer).ListRecords(ctx, req.(*ListRecordsRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _AuditLog_VerifyChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(VerifyChainRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(AuditLogServer).VerifyChain(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: AuditLog_VerifyChain_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(AuditLogServer).VerifyChain(ctx, req.(*VerifyChainRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// AuditLog_ServiceDesc is the grpc.ServiceDesc for AuditLog service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var AuditLog_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "ration.audit.v1.AuditLog",
|
|
HandlerType: (*AuditLogServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Append",
|
|
Handler: _AuditLog_Append_Handler,
|
|
},
|
|
{
|
|
MethodName: "ListRecords",
|
|
Handler: _AuditLog_ListRecords_Handler,
|
|
},
|
|
{
|
|
MethodName: "VerifyChain",
|
|
Handler: _AuditLog_VerifyChain_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "audit.proto",
|
|
}
|