1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 17:44:59 +09:00

GO-1084: Cleanup core service

This commit is contained in:
Sergey 2023-04-25 18:17:59 +02:00 committed by Mikhail Iudin
parent db21e190f4
commit 27f1d474bf
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0
6 changed files with 0 additions and 121 deletions

View file

@ -193,7 +193,6 @@ type smartBlock struct {
sendEvent func(e *pb.Event)
undo undo.History
source source.Source
metaData *core.SmartBlockMeta
lastDepDetails map[string]*pb.EventObjectDetailsSet
restrictionsUpdater func()
restrictions restriction.Restrictions

View file

@ -9,7 +9,6 @@ import (
"github.com/anytypeio/go-anytype-middleware/core/block"
"github.com/anytypeio/go-anytype-middleware/core/files"
"github.com/anytypeio/go-anytype-middleware/pb"
"github.com/anytypeio/go-anytype-middleware/pkg/lib/core"
)
func (mw *Middleware) FileDownload(cctx context.Context, req *pb.RpcFileDownloadRequest) *pb.RpcFileDownloadResponse {
@ -69,11 +68,6 @@ func (mw *Middleware) FileListOffload(cctx context.Context, req *pb.RpcFileListO
return response(0, 0, pb.RpcFileListOffloadResponseError_NODE_NOT_STARTED, fmt.Errorf("anytype is nil"))
}
at := mw.app.MustComponent(core.CName).(core.Service)
if !at.IsStarted() {
return response(0, 0, pb.RpcFileListOffloadResponseError_NODE_NOT_STARTED, fmt.Errorf("anytype node not started"))
}
fileService := app.MustComponent[*files.Service](mw.app)
totalFilesOffloaded, totalBytesOffloaded, err := fileService.FileListOffload(req.OnlyIds, req.IncludeNotPinned)
if err != nil {

View file

@ -1,2 +0,0 @@
package core

View file

@ -1,2 +0,0 @@
package core

View file

@ -1,61 +0,0 @@
package core
import (
"github.com/gogo/protobuf/proto"
cbornode "github.com/ipfs/go-ipld-cbor"
)
// increasing this version allows old clients that trying to read the newer version of payload to force user to upgrade
const payloadVersion = 1
type SmartblockLog struct {
ID string
Head string
HeadCounter int64
}
type SmartblockRecordEnvelope struct {
SmartblockRecord
AccountID string
LogID string
}
type SmartblockRecordWithThreadID struct {
SmartblockRecordEnvelope
ThreadID string
}
type ThreadRecordInfo struct {
LogId string
ThreadID string
}
type SmartblockRecord struct {
ID string
PrevID string
Payload []byte
}
type SignedPbPayload struct {
DeviceSig []byte // deprecated
AccSig []byte
AccAddr string
Data []byte
Ver uint16
}
func init() {
cbornode.RegisterCborType(SignedPbPayload{})
}
func (p *SignedPbPayload) Unmarshal(out proto.Message) error {
return proto.Unmarshal(p.Data, out)
}
func (p *SmartblockRecord) Unmarshal(out proto.Message) error {
return proto.Unmarshal(p.Payload, out)
}
func (p *SignedPbPayload) Verify() error {
return nil
}

View file

@ -1,49 +0,0 @@
package core
import (
"context"
"github.com/gogo/protobuf/proto"
"github.com/gogo/protobuf/types"
cbornode "github.com/ipfs/go-ipld-cbor"
"github.com/anytypeio/go-anytype-middleware/pkg/lib/core/smartblock"
"github.com/anytypeio/go-anytype-middleware/pkg/lib/pb/model"
)
const (
snippetMinSize = 50
snippetMaxSize = 300
)
type ProfileThreadEncryptionKeys struct {
ServiceKey []byte
ReadKey []byte
}
func init() {
cbornode.RegisterCborType(ProfileThreadEncryptionKeys{})
}
type SmartBlockMeta struct {
ObjectTypes []string
RelationLinks []*model.RelationLink
Details *types.Struct
}
type SmartBlock interface {
ID() string
Type() smartblock.SmartBlockType
Creator() (string, error)
GetLogs() ([]SmartblockLog, error)
GetRecord(ctx context.Context, recordID string) (*SmartblockRecordEnvelope, error)
PushRecord(payload proto.Marshaler) (id string, err error)
SubscribeForRecords(ch chan SmartblockRecordEnvelope) (cancel func(), err error)
// SubscribeClientEvents provide a way to subscribe for the client-side events e.g. carriage position change
SubscribeClientEvents(event chan<- proto.Message) (cancelFunc func(), err error)
// PublishClientEvent gives a way to push the new client-side event e.g. carriage position change
// notice that you will also get this event in SubscribeForEvents
PublishClientEvent(event proto.Message) error
}