-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP book.gno #1224
base: master
Are you sure you want to change the base?
WIP book.gno #1224
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1224 +/- ##
==========================================
+ Coverage 47.82% 48.08% +0.26%
==========================================
Files 369 368 -1
Lines 62710 62566 -144
==========================================
+ Hits 29992 30086 +94
+ Misses 30295 30054 -241
- Partials 2423 2426 +3 ☔ View full report in Codecov by Sentry. |
It's up to you, but you're welcome to stay here. We're increasingly allowing "personal realms" in the repository, as mentioned in issue #1138. I believe it's logical to keep most of the experiments, such as Carmel, books, Wikipedia, etc., in this repository by default. We can consider making them more autonomous to reduce noise, like when we have multiple pull requests. Up to you! |
manfred also mentioned #1244 |
Also see #1244 (comment) func (book Book) Execute(action Action) error {
// makes sure the action signatures, sequence, etc are valid.
if err != book.Owner.Append(action); err != nil {
return err
}
// the logic below could use permissions if it wanted to, or not.
switch action.(type) {
case: WriteAction:
case: ReadAction:
default: return UnrecognizedError()
}
} As long as it's assumed that the action will complete in one transaction, this is fine; although we are also assuming that the programmer programs such that ultimately there is a panic upon some error. Or maybe this is desired sometimes: func (book Book) Execute(action Action) error {
// makes sure the action signatures, sequence, etc are valid.
x, err := book.Owner.Reserve(action)
if err != nil {
return err
}
// the logic below could use permissions if it wanted to, or not.
switch action.(type) {
case: WriteAction:
case: ReadAction:
default: return UnrecognizedError()
}
// signal that the execution reserved is complete.
x.Done()
} Or javascript closure like: func (book Book) Execute(action Action) error {
// first reserves, or panics if error
book.Owner.Execute(action, func() {
// if reservation was complete:
// the logic below could use permissions if it wanted to, or not.
switch action.(type) {
case: WriteAction:
case: ReadAction:
default: return UnrecognizedError()
}
});
} which feels wrong. Some thoughts on Action... // object has an action verb (method), which takes arguments
type Action struct {
subject // is this an id?
verb // i guess a string or Name type?
object // is this an id?
arguments // are these primitive strings or any
}
// Authorization struct is only needed for Actions that require
// cryptographic authorization, where the Action's subject has
// a pubkey to verify signatures with.
//
// Presumably once Authorization is validated (signature checked)
// the Action becomes committed, and given a index number.
type Authorization struct {
action Action
signatures []Signature
}
type Signature struct {
account number // or address with some extra data unknown
sequence number // or alternative to sequence
signature []byte
} Msg:Tx :: Action:Authorization here, except type Msg interface {
Route() string
Type() string
ValidateBasic() error
GetSignBytes() []byte
GetSigners() []crypto.Address
}
type Tx struct {
Msgs []Msg
Fee Fee
Signatures []Signature
Memo string
} Interesting correspondences
|
*/ | ||
|
||
// XXX open questions | ||
// * Do we want a directory? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we need an equivalent of std.Address
specifically for objects. The directory will function as the object catalog, similar to how the tm2 account module handles key-based accounts.
❌ Deploy Preview for gno-docs2 failed.
|
This is a concept for a book (basically a list).
A Book has a title, owner, etc.
A Book can be forked.
Books can be components of a virtual Person (where a Person is an interface).
TODO: maybe I should move these experiments to another repo.