blog

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package blog is a generated protocol buffer package.

It is generated from these files:

x/blog/messages.proto
x/blog/state.proto

It has these top-level messages:

CreateBlogMsg
RenameBlogMsg
ChangeBlogAuthorsMsg
CreatePostMsg
SetProfileMsg
Blog
Post
Profile

Index

Constants

View Source
const (
	PathCreateBlogMsg        = "blog/create"
	PathRenameBlogMsg        = "blog/rename"
	PathChangeBlogAuthorsMsg = "blog/authors"
	PathCreatePostMsg        = "blog/post"
	PathSetProfileMsg        = "blog/profile"

	MinAuthors           = 1
	MaxAuthors           = 10
	MinTitleLength       = 8
	MaxTitleLength       = 100
	MinTextLength        = 200
	MaxTextLength        = 20 * 1000
	MinNameLength        = 6
	MaxNameLength        = 30
	MaxDescriptionLength = 280
)
View Source
const BlogBucketName = "blogs"
View Source
const PostBucketName = "posts"
View Source
const ProfileBucketName = "profiles"

Variables

View Source
var (
	ErrInvalidLengthMessages = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMessages   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrInvalidLengthState = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowState   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	// IsValidName is the RegExp to ensure valid profile and blog names
	IsValidName = regexp.MustCompile(`^[a-zA-Z0-9_\-\.]{6,30}$`).MatchString
)

Functions

func RegisterQuery added in v0.8.0

func RegisterQuery(qr weave.QueryRouter)

RegisterQuery register queries from buckets in this package

func RegisterRoutes added in v0.7.0

func RegisterRoutes(r weave.Registry, auth x.Authenticator)

RegisterRoutes will instantiate and register all handlers in this package

Types

type Blog

type Blog struct {
	Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	// Author bytes to be interpreted as weave.Address
	Authors     [][]byte `protobuf:"bytes,2,rep,name=authors" json:"authors,omitempty"`
	NumArticles int64    `protobuf:"varint,3,opt,name=num_articles,json=numArticles,proto3" json:"num_articles,omitempty"`
}

func (*Blog) Copy

func (b *Blog) Copy() orm.CloneableData

Copy makes a new blog with the same data

func (*Blog) Descriptor

func (*Blog) Descriptor() ([]byte, []int)

func (*Blog) GetAuthors

func (m *Blog) GetAuthors() [][]byte

func (*Blog) GetNumArticles

func (m *Blog) GetNumArticles() int64

func (*Blog) GetTitle

func (m *Blog) GetTitle() string

func (*Blog) Marshal

func (m *Blog) Marshal() (dAtA []byte, err error)

func (*Blog) MarshalTo

func (m *Blog) MarshalTo(dAtA []byte) (int, error)

func (*Blog) ProtoMessage

func (*Blog) ProtoMessage()

func (*Blog) Reset

func (m *Blog) Reset()

func (*Blog) Size

func (m *Blog) Size() (n int)

func (*Blog) String

func (m *Blog) String() string

func (*Blog) Unmarshal

func (m *Blog) Unmarshal(dAtA []byte) error

func (*Blog) Validate

func (b *Blog) Validate() error

Validate enforces limits of title size and number of authors

type BlogBucket

type BlogBucket struct {
	orm.Bucket
}

BlogBucket is a type-safe wrapper around orm.Bucket

func NewBlogBucket

func NewBlogBucket() BlogBucket

NewBlogBucket initializes a BlogBucket with default name

inherit Get and Save from orm.Bucket add run-time check on Save

func (BlogBucket) Save

func (b BlogBucket) Save(db weave.KVStore, obj orm.Object) error

Save enforces the proper type

type ChangeBlogAuthorsMsg

type ChangeBlogAuthorsMsg struct {
	// slug is a short, unique string used as primary key
	Slug string `protobuf:"bytes,1,opt,name=slug,proto3" json:"slug,omitempty"`
	// whether we add or remove them
	Add bool `protobuf:"varint,2,opt,name=add,proto3" json:"add,omitempty"`
	// author to add or remove
	Author []byte `protobuf:"bytes,3,opt,name=author,proto3" json:"author,omitempty"`
}

ChangeBlogAuthorsMsg adds or removes an author from the blog's authorized author list

func (*ChangeBlogAuthorsMsg) Descriptor

func (*ChangeBlogAuthorsMsg) Descriptor() ([]byte, []int)

func (*ChangeBlogAuthorsMsg) GetAdd

func (m *ChangeBlogAuthorsMsg) GetAdd() bool

func (*ChangeBlogAuthorsMsg) GetAuthor

func (m *ChangeBlogAuthorsMsg) GetAuthor() []byte

func (*ChangeBlogAuthorsMsg) GetSlug added in v0.7.0

func (m *ChangeBlogAuthorsMsg) GetSlug() string

func (*ChangeBlogAuthorsMsg) Marshal

func (m *ChangeBlogAuthorsMsg) Marshal() (dAtA []byte, err error)

func (*ChangeBlogAuthorsMsg) MarshalTo

func (m *ChangeBlogAuthorsMsg) MarshalTo(dAtA []byte) (int, error)

func (ChangeBlogAuthorsMsg) Path

Path returns the routing path for this message

func (*ChangeBlogAuthorsMsg) ProtoMessage

func (*ChangeBlogAuthorsMsg) ProtoMessage()

func (*ChangeBlogAuthorsMsg) Reset

func (m *ChangeBlogAuthorsMsg) Reset()

func (*ChangeBlogAuthorsMsg) Size

func (m *ChangeBlogAuthorsMsg) Size() (n int)

func (*ChangeBlogAuthorsMsg) String

func (m *ChangeBlogAuthorsMsg) String() string

func (*ChangeBlogAuthorsMsg) Unmarshal

func (m *ChangeBlogAuthorsMsg) Unmarshal(dAtA []byte) error

func (*ChangeBlogAuthorsMsg) Validate

func (s *ChangeBlogAuthorsMsg) Validate() error

Validate makes sure that this is sensible

type ChangeBlogAuthorsMsgHandler added in v0.7.0

type ChangeBlogAuthorsMsgHandler struct {
	// contains filtered or unexported fields
}

func (ChangeBlogAuthorsMsgHandler) Check added in v0.7.0

func (ChangeBlogAuthorsMsgHandler) Deliver added in v0.7.0

type CreateBlogMsg

type CreateBlogMsg struct {
	// slug is a short, unique string used as primary key
	Slug string `protobuf:"bytes,1,opt,name=slug,proto3" json:"slug,omitempty"`
	// title is longer text used for display
	Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	// initial set of authors (must be 1 - MaxAuthors)
	Authors [][]byte `protobuf:"bytes,3,rep,name=authors" json:"authors,omitempty"`
}

CreateBlogMsg starts a new blog with a set of authors

func (*CreateBlogMsg) Descriptor

func (*CreateBlogMsg) Descriptor() ([]byte, []int)

func (*CreateBlogMsg) GetAuthors

func (m *CreateBlogMsg) GetAuthors() [][]byte

func (*CreateBlogMsg) GetSlug

func (m *CreateBlogMsg) GetSlug() string

func (*CreateBlogMsg) GetTitle

func (m *CreateBlogMsg) GetTitle() string

func (*CreateBlogMsg) Marshal

func (m *CreateBlogMsg) Marshal() (dAtA []byte, err error)

func (*CreateBlogMsg) MarshalTo

func (m *CreateBlogMsg) MarshalTo(dAtA []byte) (int, error)

func (CreateBlogMsg) Path

func (CreateBlogMsg) Path() string

Path returns the routing path for this message

func (*CreateBlogMsg) ProtoMessage

func (*CreateBlogMsg) ProtoMessage()

func (*CreateBlogMsg) Reset

func (m *CreateBlogMsg) Reset()

func (*CreateBlogMsg) Size

func (m *CreateBlogMsg) Size() (n int)

func (*CreateBlogMsg) String

func (m *CreateBlogMsg) String() string

func (*CreateBlogMsg) Unmarshal

func (m *CreateBlogMsg) Unmarshal(dAtA []byte) error

func (*CreateBlogMsg) Validate

func (s *CreateBlogMsg) Validate() error

Validate makes sure that this is sensible

type CreateBlogMsgHandler added in v0.7.0

type CreateBlogMsgHandler struct {
	// contains filtered or unexported fields
}

func (CreateBlogMsgHandler) Check added in v0.7.0

func (CreateBlogMsgHandler) Deliver added in v0.7.0

type CreatePostMsg

type CreatePostMsg struct {
	// blog is the slug of the blog this post belongs to
	Blog  string `protobuf:"bytes,1,opt,name=blog,proto3" json:"blog,omitempty"`
	Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Text  string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"`
	// author is optional, by default the first signer,
	// only needed if it is multisig
	Author []byte `protobuf:"bytes,4,opt,name=author,proto3" json:"author,omitempty"`
}

CreatePostMsg adds a post to a blog

func (*CreatePostMsg) Descriptor

func (*CreatePostMsg) Descriptor() ([]byte, []int)

func (*CreatePostMsg) GetAuthor

func (m *CreatePostMsg) GetAuthor() []byte

func (*CreatePostMsg) GetBlog

func (m *CreatePostMsg) GetBlog() string

func (*CreatePostMsg) GetText

func (m *CreatePostMsg) GetText() string

func (*CreatePostMsg) GetTitle

func (m *CreatePostMsg) GetTitle() string

func (*CreatePostMsg) Marshal

func (m *CreatePostMsg) Marshal() (dAtA []byte, err error)

func (*CreatePostMsg) MarshalTo

func (m *CreatePostMsg) MarshalTo(dAtA []byte) (int, error)

func (CreatePostMsg) Path

func (CreatePostMsg) Path() string

Path returns the routing path for this message

func (*CreatePostMsg) ProtoMessage

func (*CreatePostMsg) ProtoMessage()

func (*CreatePostMsg) Reset

func (m *CreatePostMsg) Reset()

func (*CreatePostMsg) Size

func (m *CreatePostMsg) Size() (n int)

func (*CreatePostMsg) String

func (m *CreatePostMsg) String() string

func (*CreatePostMsg) Unmarshal

func (m *CreatePostMsg) Unmarshal(dAtA []byte) error

func (*CreatePostMsg) Validate

func (s *CreatePostMsg) Validate() error

Validate makes sure that this is sensible

type CreatePostMsgHandler added in v0.7.0

type CreatePostMsgHandler struct {
	// contains filtered or unexported fields
}

func (CreatePostMsgHandler) Check added in v0.7.0

func (CreatePostMsgHandler) Deliver added in v0.7.0

type Post

type Post struct {
	Title  string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Author []byte `protobuf:"bytes,2,opt,name=author,proto3" json:"author,omitempty"`
	// a timestamp would differ between nodes and be
	// non-deterministic when replaying blocks.
	// block height is the only constant
	CreationBlock int64  `protobuf:"varint,3,opt,name=creation_block,json=creationBlock,proto3" json:"creation_block,omitempty"`
	Text          string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"`
}

func (*Post) Copy

func (p *Post) Copy() orm.CloneableData

Copy makes a new Post with the same data

func (*Post) Descriptor

func (*Post) Descriptor() ([]byte, []int)

func (*Post) GetAuthor

func (m *Post) GetAuthor() []byte

func (*Post) GetCreationBlock

func (m *Post) GetCreationBlock() int64

func (*Post) GetText

func (m *Post) GetText() string

func (*Post) GetTitle

func (m *Post) GetTitle() string

func (*Post) Marshal

func (m *Post) Marshal() (dAtA []byte, err error)

func (*Post) MarshalTo

func (m *Post) MarshalTo(dAtA []byte) (int, error)

func (*Post) ProtoMessage

func (*Post) ProtoMessage()

func (*Post) Reset

func (m *Post) Reset()

func (*Post) Size

func (m *Post) Size() (n int)

func (*Post) String

func (m *Post) String() string

func (*Post) Unmarshal

func (m *Post) Unmarshal(dAtA []byte) error

func (*Post) Validate

func (p *Post) Validate() error

Validate enforces limits of text and title size

type PostBucket

type PostBucket struct {
	orm.Bucket
}

PostBucket is a type-safe wrapper around orm.Bucket

func NewPostBucket

func NewPostBucket() PostBucket

NewPostBucket initializes a PostBucket with default name

inherit Get and Save from orm.Bucket add run-time check on Save

func (PostBucket) Save

func (b PostBucket) Save(db weave.KVStore, obj orm.Object) error

Save enforces the proper type

type Profile

type Profile struct {
	Name        string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
}

func (*Profile) Copy

func (p *Profile) Copy() orm.CloneableData

Copy makes a new Profile with the same data

func (*Profile) Descriptor

func (*Profile) Descriptor() ([]byte, []int)

func (*Profile) GetDescription

func (m *Profile) GetDescription() string

func (*Profile) GetName

func (m *Profile) GetName() string

func (*Profile) Marshal

func (m *Profile) Marshal() (dAtA []byte, err error)

func (*Profile) MarshalTo

func (m *Profile) MarshalTo(dAtA []byte) (int, error)

func (*Profile) ProtoMessage

func (*Profile) ProtoMessage()

func (*Profile) Reset

func (m *Profile) Reset()

func (*Profile) Size

func (m *Profile) Size() (n int)

func (*Profile) String

func (m *Profile) String() string

func (*Profile) Unmarshal

func (m *Profile) Unmarshal(dAtA []byte) error

func (*Profile) Validate

func (p *Profile) Validate() error

Validate enforces limits of text and title size

type ProfileBucket

type ProfileBucket struct {
	orm.Bucket
}

ProfileBucket is a type-safe wrapper around orm.Bucket

func NewProfileBucket

func NewProfileBucket() ProfileBucket

NewProfileBucket initializes a ProfileBucket with default name

inherit Get and Save from orm.Bucket add run-time check on Save

func (ProfileBucket) Save

func (b ProfileBucket) Save(db weave.KVStore, obj orm.Object) error

Save enforces the proper type

type RenameBlogMsg

type RenameBlogMsg struct {
	// slug is a short, unique string used as primary key
	Slug string `protobuf:"bytes,1,opt,name=slug,proto3" json:"slug,omitempty"`
	// title is longer text used for display
	Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
}

RenameBlogMsg updates the title of an existing blog

func (*RenameBlogMsg) Descriptor

func (*RenameBlogMsg) Descriptor() ([]byte, []int)

func (*RenameBlogMsg) GetSlug

func (m *RenameBlogMsg) GetSlug() string

func (*RenameBlogMsg) GetTitle

func (m *RenameBlogMsg) GetTitle() string

func (*RenameBlogMsg) Marshal

func (m *RenameBlogMsg) Marshal() (dAtA []byte, err error)

func (*RenameBlogMsg) MarshalTo

func (m *RenameBlogMsg) MarshalTo(dAtA []byte) (int, error)

func (RenameBlogMsg) Path

func (RenameBlogMsg) Path() string

Path returns the routing path for this message

func (*RenameBlogMsg) ProtoMessage

func (*RenameBlogMsg) ProtoMessage()

func (*RenameBlogMsg) Reset

func (m *RenameBlogMsg) Reset()

func (*RenameBlogMsg) Size

func (m *RenameBlogMsg) Size() (n int)

func (*RenameBlogMsg) String

func (m *RenameBlogMsg) String() string

func (*RenameBlogMsg) Unmarshal

func (m *RenameBlogMsg) Unmarshal(dAtA []byte) error

func (*RenameBlogMsg) Validate

func (s *RenameBlogMsg) Validate() error

Validate makes sure that this is sensible

type RenameBlogMsgHandler added in v0.7.0

type RenameBlogMsgHandler struct {
	// contains filtered or unexported fields
}

func (RenameBlogMsgHandler) Check added in v0.7.0

func (RenameBlogMsgHandler) Deliver added in v0.7.0

type SetProfileMsg

type SetProfileMsg struct {
	Name        string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	// author is optional, by default the first signer,
	// only needed if it is multisig
	Author []byte `protobuf:"bytes,3,opt,name=author,proto3" json:"author,omitempty"`
}

SetProfileMsg will create or update a profile

func (*SetProfileMsg) Descriptor

func (*SetProfileMsg) Descriptor() ([]byte, []int)

func (*SetProfileMsg) GetAuthor

func (m *SetProfileMsg) GetAuthor() []byte

func (*SetProfileMsg) GetDescription

func (m *SetProfileMsg) GetDescription() string

func (*SetProfileMsg) GetName

func (m *SetProfileMsg) GetName() string

func (*SetProfileMsg) Marshal

func (m *SetProfileMsg) Marshal() (dAtA []byte, err error)

func (*SetProfileMsg) MarshalTo

func (m *SetProfileMsg) MarshalTo(dAtA []byte) (int, error)

func (SetProfileMsg) Path

func (SetProfileMsg) Path() string

Path returns the routing path for this message

func (*SetProfileMsg) ProtoMessage

func (*SetProfileMsg) ProtoMessage()

func (*SetProfileMsg) Reset

func (m *SetProfileMsg) Reset()

func (*SetProfileMsg) Size

func (m *SetProfileMsg) Size() (n int)

func (*SetProfileMsg) String

func (m *SetProfileMsg) String() string

func (*SetProfileMsg) Unmarshal

func (m *SetProfileMsg) Unmarshal(dAtA []byte) error

func (*SetProfileMsg) Validate

func (s *SetProfileMsg) Validate() error

Validate makes sure that this is sensible

type SetProfileMsgHandler added in v0.7.0

type SetProfileMsgHandler struct {
	// contains filtered or unexported fields
}

func (SetProfileMsgHandler) Check added in v0.7.0

func (SetProfileMsgHandler) Deliver added in v0.7.0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL