Commit Graph

165 Commits

Author SHA1 Message Date
Erik Arvidsson e29d9eeb95 NomDL Blob: Remove redundant test 2015-10-12 17:53:51 -04:00
Erik Arvidsson 0d6f8be3e8 NomDL: Use base64 for Blobs for now
Encode embedded blobs as base64 encoded strings.
2015-10-12 17:47:28 -04:00
Chris Masone cc15992778 Initial support for importing type pacakges by ref
Towards #294
2015-10-09 15:19:06 -07:00
Erik Arvidsson 1180d2aacb Fix build bustage 2015-10-09 14:35:33 -07:00
Erik Arvidsson 9795d49074 Always wrap list, map and set in an array 2015-10-09 14:10:05 -07:00
Erik Arvidsson 37336f41be NomDL serializing
This now handles serializing TypeRef values
2015-10-09 14:09:49 -07:00
Erik Arvidsson 9cb7596409 NomDL: Make NomsValue a Value
This means that when we ReadValue we can now return a NomsValue

Towards #281
2015-10-06 16:38:11 -07:00
Erik Arvidsson 2dec53453e NomDL: Add new serialization format
The new serialization format use "t " as in typed. The rest of the
message is a JSON array describing the typed data. The type is
described by types.TypeRef

Fixes #384
Issues #281, #304
2015-10-06 15:56:10 -07:00
cmasone-attic e64e313498 Merge pull request #383 from cmasone-attic/issue294
Add functions to codegen.go for generating dependency code
2015-10-06 09:06:43 -07:00
Chris Masone 646519131c Address comments 2015-10-05 15:40:35 -07:00
Chris Masone 3dc61b673c Add functions to codegen.go for generating dependency code
This adds code for finding imported type packages and generating
code for them, but does not yet handle generating code that uses
those types.

Towards issue #294
2015-10-04 18:05:50 -04:00
Dan Willhite b3ae2f89a9 Issue #379 - Add IterAllP function to types.go. 2015-10-02 11:29:08 -07:00
Erik Arvidsson 096ac4a224 Add index to List Iter, IterAll, Map, MapP
Fixes #376
2015-10-01 17:53:21 -04:00
Erik Arvidsson 8c2caa3b27 NomDL Codegen: Add TypeRef method to typed objects 2015-09-30 17:48:32 -04:00
Erik Arvidsson ede5f43204 Value should also have a TypeRef
This is so that we can get the runtime type of a value
2015-09-30 16:15:13 -04:00
Chris Masone 9168a902f9 Modify codegen to include pacakge refs for unresolved types
Also, switch to using a ref.Ref when getting/setting the package
ref in a TypeRef. Using a types.Ref just led to lots of manual
boxing and unboxing every time I wanted to use the reference.

Toward issue #294
2015-09-29 12:58:56 -07:00
Chris Masone 5ce93dad2e Beginning of import support in NomDL
This patch mostly merges parse.Package and types.Package, though it
can't quite go all the way. A types.Package doesn't have 'using'
declarations, while the parsed representation of a .noms file needs to
have that information. Hence, the parse package is moved to the 'pkg'
package, and pkg.Parsed is introduced. This type embeds types.Package
and adds the necessary additional information.

To make inroads on handling imports, I enhanced ParsePackage() (now
called ParseNomDL()) to actually process the 'alias' and 'import'
statements in the input and go replace namespaced type names in the
package with refs of imported packages. For example, the TypeRef for
'Bar' generated in the following package

alias Foo = import "sha1-ffffffff"

struct Bar {
  f: Foo.RockinStruct
}

will actually return types.Ref{sha1-ffffffff} when you call PackageRef()
on it.

In addition, I've added a function to the new 'pkg' package,
which allows the caller to get the dependencies of a type package
from a chunk store.

Fixes issue #353, towards issue #294
2015-09-28 16:08:22 -07:00
Rafael Weinstein 6c5b2eb6f4 Avoid Excess Ref Computation 2015-09-26 11:33:04 -07:00
Chris Masone 6a125243ff Clean up some comments, early return in CompoundDesc.Equals 2015-09-25 16:05:38 -07:00
Chris Masone c80a1c55b3 Merge parse.TypeRef and types.TypeRef
These were two representations of, essentially, the same information.
They were separate because they provided different APIs to similar
information, but the APIs became more similar once we started using
native types (as opposed to Noms types) for the various Make*TypeRef()
functions.

Unifying these is a big step to unifying parse.Package and types.Package,
which is pretty necessary for dealing with imported packages.

Fixes issue #338
2015-09-25 15:17:49 -07:00
Erik Arvidsson bf095dab3c Merge branch 'master' into nomdl-optional-codegen 2015-09-25 17:20:23 -04:00
Erik Arvidsson d17dc67a73 NomDL CodeGen: Rename self 2015-09-25 17:17:12 -04:00
Erik Arvidsson c254a1391a Codegen for optional fields in structs 2015-09-25 17:08:57 -04:00
Erik Arvidsson 5b3f611104 NomDL Codegen: Add optional flag to Field 2015-09-25 14:38:41 -04:00
Chris Masone b12a89c0df Change types.TypeRef creation API to use native types instead of Noms.
These are just easier to work with. The internal representation remains
the same.

Towards issue #338
2015-09-24 12:57:51 -07:00
Chris Masone cdb22e131b Address comments 2015-09-23 11:49:14 -07:00
Chris Masone 63c956a5c5 Add types.TypeRef
We want to explore encoding type information about Noms data in
the Noms database. So, we need some way to describe types. This
takes the shortest path to making a Noms type called "TypeRef" that
is a peer of Set, Map et al and can describe all the types we currently
use.
2015-09-22 16:19:38 -07:00
Rafael Weinstein 591026bcfa Chunk 2015-09-21 13:24:41 -07:00
Erik Arvidsson 1a4bdae624 Make types.Ref explicit
No more implicit Get or Equals
2015-09-18 14:03:19 -04:00
Erik Arvidsson bbe396fb94 Merge pull request #308 from arv/set-extras
NomDL: Codegen for Set extras
2015-09-17 17:25:59 -04:00
Erik Arvidsson 0203a71e9d Merge pull request #309 from arv/map-extras
NomDL: CodeGen for Map extras
2015-09-17 17:23:43 -04:00
Erik Arvidsson f64f6ae81c NomDL: CodeGen for Map extras
This adds Iter, IterAll and Filter to Maps

Issue #303
2015-09-17 17:20:49 -04:00
Erik Arvidsson 175cc7ccc1 NomDL: Codegen for Set extras
This adds Iter, IterAll and Filter to Sets

Issue #303
2015-09-17 16:49:22 -04:00
Rafael Weinstein 8d56b8c968 Reland: ChunkSource.Get() now returns a []byte. chunks.Serialize takes a stream of Chunks 2015-09-17 12:31:25 -07:00
Erik Arvidsson 5a83b23f29 NomDL: Codegen for List extras
Adds Iter, IterAll and Filter to the List(T) types

Depends on PR #298

Issue #303
2015-09-17 14:24:36 -04:00
Erik Arvidsson e10e6224b0 Codegen for NomDL
This adds a new codegen that reads .noms files and generates Go
API for these types

Issue #304
2015-09-17 14:01:49 -04:00
Rafael Weinstein a62cf1bbb8 Revert "ChunkSouce.Get() now returns []byte"
This reverts commit 2be269acf4.
2015-09-16 20:47:36 -07:00
Aaron Boodman 522df3055b Merge pull request #302 from aboodman/stable-gen
nomgen: stabilize the order types are generated in across runs
2015-09-16 17:41:39 -07:00
Aaron Boodman 91df15a12a nomgen: stabilize the order types are generated in 2015-09-16 17:26:31 -07:00
Rafael Weinstein 2be269acf4 ChunkSouce.Get() now returns []byte 2015-09-16 16:42:36 -07:00
Rafael Weinstein dddf81b095 Add List.Map & List.MapP 2015-09-08 15:12:24 -07:00
Erik Arvidsson 7966384aeb Get rid of alice-short.txt
Use a deterministic pseudo random list instead
2015-09-08 11:20:12 -04:00
Aaron Boodman 47953557d8 fix build 2015-09-04 16:18:09 -07:00
Aaron Boodman dc2ef0274d remove drone.yml and purposely break build to test 2015-09-04 16:16:21 -07:00
Aaron Boodman f58670bc83 NewBlob(): Reader.Read() can return both data and error.
Fixes #264
2015-09-04 15:02:29 -07:00
Erik Arvidsson 58e6666f83 Minor cleanup of compound list append 2015-09-04 14:28:29 -04:00
Erik Arvidsson d06da3ca0a Chunking: Multi level chunking for blobs
After a compound blob is created we try to chunk it again in a similar
way to how we chunk Lists. We use the refs of the sub blob and compute
a rolling hash over these. If the hash matches a pattern then we split
the existing compound blob into a new compound blob with sub blobs
which are slices of the original compound blob.

Issue #17
2015-09-03 19:47:17 -04:00
Erik Arvidsson 57c5fd9eeb Introduce a list iterator to get rid of O(log n) lookups in loops
When we are building the chunked lists we had a lot of loops that did
O(log n) Get operations. Since we are just getting consecutive elements
from the list we can make getting the next one O(1) making these loop
go from O(n*log(n)) to O(n)

Issue #215
2015-08-31 18:00:41 -04:00
Erik Arvidsson 8d85cc4625 Optimize compound list - tail part
When we write the part after the change and we hit a chunk split we
check whether the list also had a split at the same index (adjusted
for adding/removal). If it did then we know that the rest of the sub
list are the same.

Issue #215
2015-08-31 10:50:01 -04:00
Aaron Boodman 6cb4d613b7 Update godeps 2015-08-30 17:11:04 -07:00