mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-10 18:10:49 +09:00
add GenerateSvg flag to DebugTree method
This commit is contained in:
parent
60833945e0
commit
60ea7b914a
6 changed files with 69 additions and 18 deletions
|
@ -47,7 +47,9 @@ var dumpTree = &cobra.Command{
|
|||
|
||||
dbg := app.MustComponent(debug.CName).(debug.Debug)
|
||||
|
||||
filename, err := dbg.DumpTree(debugThread, debugOutputFile, false)
|
||||
isAnonymize := false
|
||||
dumpWithSvg := false
|
||||
filename, err := dbg.DumpTree(debugThread, debugOutputFile, isAnonymize, dumpWithSvg)
|
||||
if err != nil {
|
||||
console.Fatal("failed to dump tree: %s", err.Error())
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ func (mw *Middleware) DebugTree(req *pb.RpcDebugTreeRequest) *pb.RpcDebugTreeRes
|
|||
}
|
||||
|
||||
dbg := app.MustComponent(debug.CName).(debug.Debug)
|
||||
filename, err := dbg.DumpTree(req.BlockId, req.Path, !req.Unanonymized)
|
||||
filename, err := dbg.DumpTree(req.BlockId, req.Path, !req.Unanonymized, req.GenerateSvg)
|
||||
return response(err, filename)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ func New() Debug {
|
|||
|
||||
type Debug interface {
|
||||
app.Component
|
||||
DumpTree(blockId, path string, anonymize bool) (filename string, err error)
|
||||
DumpTree(blockId, path string, anonymize bool, withSvg bool) (filename string, err error)
|
||||
DumpLocalstore(objectIds []string, path string) (filename string, err error)
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ func (d *debug) Name() (name string) {
|
|||
return CName
|
||||
}
|
||||
|
||||
func (d *debug) DumpTree(blockId, path string, anonymize bool) (filename string, err error) {
|
||||
func (d *debug) DumpTree(blockId, path string, anonymize bool, withSvg bool) (filename string, err error) {
|
||||
// 0 - get first block
|
||||
block, err := d.core.GetBlock(blockId)
|
||||
if err != nil {
|
||||
|
@ -62,6 +62,11 @@ func (d *debug) DumpTree(blockId, path string, anonymize bool) (filename string,
|
|||
return "", err
|
||||
}
|
||||
|
||||
// if client never asked for SVG generation -> return
|
||||
if !withSvg {
|
||||
return zipFilename, err
|
||||
}
|
||||
|
||||
// 2 - create SVG file near ZIP
|
||||
// <path>/at.dbg.bafkudtugh626rrqzah3kam4yj4lqbaw4bjayn2rz4ah4n5fpayppbvmq.20220322.121049.23.svg
|
||||
t, _, err := change.BuildTree(block)
|
||||
|
|
|
@ -7029,6 +7029,7 @@ commands acceptable only for text blocks, others will be ignored
|
|||
| blockId | [string](#string) | | |
|
||||
| path | [string](#string) | | |
|
||||
| unanonymized | [bool](#bool) | | set to true to disable mocking of the actual data inside changes |
|
||||
| generateSvg | [bool](#bool) | | set to true to write both ZIP and SVG files |
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -37447,6 +37447,7 @@ type RpcDebugTreeRequest struct {
|
|||
BlockId string `protobuf:"bytes,1,opt,name=blockId,proto3" json:"blockId,omitempty"`
|
||||
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
|
||||
Unanonymized bool `protobuf:"varint,3,opt,name=unanonymized,proto3" json:"unanonymized,omitempty"`
|
||||
GenerateSvg bool `protobuf:"varint,4,opt,name=generateSvg,proto3" json:"generateSvg,omitempty"`
|
||||
}
|
||||
|
||||
func (m *RpcDebugTreeRequest) Reset() { *m = RpcDebugTreeRequest{} }
|
||||
|
@ -37503,6 +37504,13 @@ func (m *RpcDebugTreeRequest) GetUnanonymized() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (m *RpcDebugTreeRequest) GetGenerateSvg() bool {
|
||||
if m != nil {
|
||||
return m.GenerateSvg
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type RpcDebugTreeResponse struct {
|
||||
Error *RpcDebugTreeResponseError `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
|
||||
Filename string `protobuf:"bytes,2,opt,name=filename,proto3" json:"filename,omitempty"`
|
||||
|
@ -38563,7 +38571,7 @@ func init() {
|
|||
func init() { proto.RegisterFile("pb/protos/commands.proto", fileDescriptor_8261c968b2e6f45c) }
|
||||
|
||||
var fileDescriptor_8261c968b2e6f45c = []byte{
|
||||
// 10089 bytes of a gzipped FileDescriptorProto
|
||||
// 10106 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x7d, 0x7b, 0x94, 0x24, 0x57,
|
||||
0x79, 0x9f, 0xba, 0xab, 0x1f, 0x33, 0xdf, 0xee, 0xec, 0xb6, 0xca, 0xcb, 0x6a, 0xb8, 0x12, 0x8b,
|
||||
0x58, 0x24, 0x21, 0x64, 0xd1, 0x8b, 0x56, 0x08, 0x24, 0xa1, 0x07, 0x3d, 0x3d, 0x3d, 0xbb, 0xad,
|
||||
|
@ -38578,7 +38586,7 @@ var fileDescriptor_8261c968b2e6f45c = []byte{
|
|||
0xaa, 0xac, 0x9f, 0xe9, 0xaf, 0x9f, 0xd9, 0xd1, 0x7b, 0x58, 0x75, 0x5f, 0x20, 0x09, 0x5a, 0x1c,
|
||||
0xdd, 0x1c, 0x56, 0x4a, 0xd5, 0xbb, 0xb2, 0x6a, 0x5a, 0xba, 0x81, 0x69, 0xc9, 0x93, 0x7e, 0x93,
|
||||
0x78, 0x17, 0x6b, 0x96, 0x5b, 0xc3, 0x75, 0x9b, 0xba, 0xbe, 0xa9, 0x62, 0xe7, 0xd9, 0xfa, 0x60,
|
||||
0xe3, 0x8c, 0x69, 0x19, 0x83, 0xae, 0xe5, 0x3c, 0x3d, 0xfd, 0xc6, 0x37, 0xe7, 0x40, 0x90, 0xfa,
|
||||
0xe3, 0x8c, 0x69, 0x19, 0x83, 0xae, 0xe5, 0x3c, 0x3d, 0xfd, 0xc9, 0x37, 0xe7, 0x40, 0x90, 0xfa,
|
||||
0x5d, 0xf4, 0x58, 0x16, 0x8a, 0xcb, 0xd8, 0x32, 0x94, 0xae, 0x89, 0x3e, 0x96, 0x85, 0xb9, 0x36,
|
||||
0xb6, 0x56, 0x64, 0x43, 0xde, 0xc1, 0x16, 0x36, 0x4c, 0x74, 0x23, 0x14, 0x25, 0xfc, 0xa2, 0x01,
|
||||
0x36, 0x2d, 0x11, 0xc1, 0x4c, 0x5f, 0x95, 0xad, 0x0d, 0xdd, 0xd8, 0x99, 0xcf, 0x5c, 0x9f, 0xb9,
|
||||
|
@ -39151,7 +39159,7 @@ var fileDescriptor_8261c968b2e6f45c = []byte{
|
|||
0xe4, 0x65, 0xb0, 0xf6, 0x7a, 0x91, 0xbb, 0x92, 0xe1, 0x36, 0x62, 0xb8, 0x76, 0xfc, 0x14, 0xd7,
|
||||
0x3e, 0x63, 0x4c, 0x03, 0x87, 0xc8, 0xe2, 0x2f, 0x66, 0x61, 0xae, 0xd2, 0xef, 0xab, 0x7b, 0xde,
|
||||
0x34, 0x1f, 0xe7, 0xa0, 0x26, 0xe0, 0x63, 0x25, 0xbb, 0xcf, 0xc7, 0xca, 0x0f, 0xb8, 0x97, 0x01,
|
||||
0x86, 0x80, 0x10, 0xe5, 0x05, 0xdf, 0xb4, 0x1f, 0x55, 0x53, 0xfa, 0x73, 0xd6, 0x6b, 0x7e, 0x06,
|
||||
0x86, 0x80, 0x10, 0xe5, 0x05, 0xdf, 0xb4, 0x1f, 0x55, 0x53, 0xfa, 0x73, 0xd6, 0x87, 0x7e, 0x06,
|
||||
0xf2, 0x24, 0xf2, 0x19, 0x7a, 0x8f, 0x00, 0x45, 0x55, 0xdf, 0xac, 0x6b, 0x1b, 0xfa, 0x28, 0x4b,
|
||||
0xc3, 0x2d, 0xec, 0xdd, 0xc4, 0x24, 0xff, 0xc5, 0x9b, 0xe0, 0x98, 0xfd, 0xeb, 0xca, 0x07, 0x75,
|
||||
0xd5, 0x3e, 0x23, 0x0d, 0xe5, 0x8a, 0xa7, 0xe1, 0xa8, 0xa5, 0x5b, 0xb2, 0x1a, 0xb4, 0x70, 0xcf,
|
||||
|
@ -39184,17 +39192,18 @@ var fileDescriptor_8261c968b2e6f45c = []byte{
|
|||
0xcd, 0x0c, 0x89, 0x13, 0xa7, 0xb7, 0xe6, 0x50, 0x14, 0xd2, 0x5f, 0x66, 0x3e, 0x2e, 0x40, 0xc1,
|
||||
0x61, 0x39, 0x7a, 0x55, 0x86, 0x71, 0x00, 0x40, 0x41, 0xf5, 0x1c, 0x00, 0xb8, 0xe9, 0x29, 0xc9,
|
||||
0xf0, 0xdb, 0xf8, 0x5d, 0x40, 0x13, 0xee, 0x39, 0x9d, 0x08, 0xb5, 0xe9, 0xcb, 0x29, 0xda, 0x86,
|
||||
0x4e, 0x8f, 0xe7, 0xc6, 0x88, 0x30, 0x29, 0xca, 0xa9, 0xb6, 0x88, 0x68, 0x7b, 0x2a, 0x81, 0xc5,
|
||||
0x73, 0xf6, 0x34, 0x8f, 0x5e, 0xc0, 0x84, 0x99, 0x59, 0xa7, 0x21, 0x2f, 0x68, 0x14, 0x2d, 0x9a,
|
||||
0x1c, 0xa9, 0x07, 0x3b, 0x0d, 0x47, 0x07, 0x9a, 0xac, 0xe9, 0xda, 0xde, 0x8e, 0xf2, 0x62, 0x6f,
|
||||
0xa3, 0xc0, 0xe4, 0xb1, 0x66, 0x7a, 0x1c, 0x93, 0x89, 0x4d, 0x51, 0x78, 0x80, 0xe7, 0x0d, 0x45,
|
||||
0xc5, 0xc4, 0xdc, 0xdf, 0xf5, 0x29, 0x4d, 0xd3, 0xb1, 0x46, 0xca, 0x88, 0x26, 0xd2, 0xe7, 0xf6,
|
||||
0xdf, 0x67, 0xe0, 0xc4, 0x39, 0xac, 0x61, 0x43, 0xe9, 0x3a, 0x9d, 0xe2, 0xf2, 0xd7, 0x38, 0xea,
|
||||
0x0d, 0x76, 0x33, 0xca, 0xe7, 0x69, 0x31, 0xbc, 0x9e, 0xf4, 0x0f, 0x4a, 0x8a, 0x90, 0x27, 0xe3,
|
||||
0x7a, 0xe1, 0xba, 0xcf, 0x3f, 0x7e, 0x2a, 0xf3, 0xe5, 0xc7, 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, 0xc9,
|
||||
0xc8, 0x5f, 0xb8, 0xee, 0xf3, 0x8f, 0x9f, 0xca, 0x7c, 0xf9, 0xf1, 0x53, 0x99, 0x6f, 0x3d, 0x7e,
|
||||
0x2a, 0xf3, 0xab, 0xdf, 0x39, 0x75, 0xd5, 0x97, 0xbf, 0x73, 0xea, 0xaa, 0xbf, 0xfa, 0xce, 0xa9,
|
||||
0xab, 0xfe, 0x59, 0xb6, 0xbf, 0xbe, 0x5e, 0x20, 0x96, 0xb0, 0xb7, 0xff, 0xbf, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x39, 0xe9, 0xd9, 0x66, 0x97, 0x0e, 0x01, 0x00,
|
||||
}
|
||||
|
||||
func (m *Rpc) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -63454,6 +63463,16 @@ func (m *RpcDebugTreeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.GenerateSvg {
|
||||
i--
|
||||
if m.GenerateSvg {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x20
|
||||
}
|
||||
if m.Unanonymized {
|
||||
i--
|
||||
if m.Unanonymized {
|
||||
|
@ -73914,6 +73933,9 @@ func (m *RpcDebugTreeRequest) Size() (n int) {
|
|||
if m.Unanonymized {
|
||||
n += 2
|
||||
}
|
||||
if m.GenerateSvg {
|
||||
n += 2
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
|
@ -140299,6 +140321,26 @@ func (m *RpcDebugTreeRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
}
|
||||
m.Unanonymized = bool(v != 0)
|
||||
case 4:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field GenerateSvg", wireType)
|
||||
}
|
||||
var v int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowCommands
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
v |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
m.GenerateSvg = bool(v != 0)
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipCommands(dAtA[iNdEx:])
|
||||
|
|
|
@ -4162,6 +4162,7 @@ message Rpc {
|
|||
string blockId = 1;
|
||||
string path = 2;
|
||||
bool unanonymized = 3; // set to true to disable mocking of the actual data inside changes
|
||||
bool generateSvg = 4; // set to true to write both ZIP and SVG files
|
||||
}
|
||||
|
||||
message Response {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue